by yuttie

Brings physics-based smooth scrolling to the Vim world!

495 Stars 18 Forks Last release: Not found MIT License 38 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


Brings physics-based smooth scrolling to the Vim/Neovim world!

This is highly motivated by the lack of a plugin similar to my favorite Emacs package emacs-inertial-scroll.

Scroll with

: Scroll with `C-d`/`C-u`

Scroll with

: Scroll with `C-f`/`C-b`


This plugin depends on the timer API, which requires Vim/Neovim to be at least the following version:

  • Vim 7.4.1578 or above
  • Neovim 0.1.5 or above

However, currently, this plugin is only tested on Vim 8.0 and Neovim 0.1.7, i.e. my current development environment.


For example, with vim-plug:

Plug 'yuttie/comfortable-motion.vim'


Please note that the following mappings for

 are not ones for you if you expect they scroll a buffer just half a window.

Scrolling Method

This plugin relies on

 by default to actually scroll a window.
You can customize these keys to other combinations like 
as follows:
let g:comfortable_motion_scroll_down_key = "j"
let g:comfortable_motion_scroll_up_key = "k"

This results in:

Different scrolling method

Please note that you cannot choose complex keys consisting of multiple motions, e.g.

. This is because the current implementation prepends the number of scroll amount to the keys, e.g.
, and executes it once per simulation tick.

Keys and Mouse Wheel

By default, the following key mappings are defined.

nnoremap   :call comfortable_motion#flick(100)
nnoremap   :call comfortable_motion#flick(-100)

nnoremap :call comfortable_motion#flick(200) nnoremap :call comfortable_motion#flick(-200)

To prevent the plugin from defining those default key mappings, you can set

to 1.
let g:comfortable_motion_no_default_key_mappings = 1

Additionally, if your Vim/NeoVim has mouse support, you can get mouse wheel to scroll a window by the following mappings:

noremap   :call comfortable_motion#flick(40)
noremap     :call comfortable_motion#flick(-40)

You may need to enable the

option for the above to work, for example, by
set mouse=a

Simulation Parameters

There are three configurable parameters:

  • g:comfortable_motion_interval
    [default: 1000.0 / 60]
  • g:comfortable_motion_friction
    [default: 80.0]
  • g:comfortable_motion_air_drag
    [default: 2.0]

For example, with any of the following configurations, you can get

 (with the
default impulse value of 
) to scroll a window about 25 lines, but tastes are different.

Friction & Air Resistance

let g:comfortable_motion_friction = 80.0
let g:comfortable_motion_air_drag = 2.0

Friction Only

let g:comfortable_motion_friction = 200.0
let g:comfortable_motion_air_drag = 0.0

Air Resistance Only

let g:comfortable_motion_friction = 0.0
let g:comfortable_motion_air_drag = 4.0

Advanced Configurations

If you would like to use scrolling proportional to the window height, you may use settings such as these:

let g:comfortable_motion_no_default_key_mappings = 1
let g:comfortable_motion_impulse_multiplier = 1  " Feel free to increase/decrease this value.
nnoremap   :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 2)
nnoremap   :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -2)
nnoremap   :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 4)
nnoremap   :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -4)


MIT License

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.