All Projects β†’ yuttie β†’ Comfortable Motion.vim

yuttie / Comfortable Motion.vim

Licence: mit
Brings physics-based smooth scrolling to the Vim world!

Projects that are alternatives of or similar to Comfortable Motion.vim

Close Buffers.vim
πŸ“– Quickly close (bdelete) several buffers at once πŸ“•
Stars: ✭ 99 (-81.77%)
Mutual labels:  plugin, neovim
Iris.vim
πŸ“« Simple mail client for Vim.
Stars: ✭ 148 (-72.74%)
Mutual labels:  plugin, neovim
Nvim Toggleterm.lua
A neovim lua plugin to help easily manage multiple terminal windows
Stars: ✭ 102 (-81.22%)
Mutual labels:  plugin, neovim
Neoformat
✨ A (Neo)vim plugin for formatting code.
Stars: ✭ 977 (+79.93%)
Mutual labels:  plugin, neovim
Vim Sneak
The missing motion for Vim πŸ‘Ÿ
Stars: ✭ 2,467 (+354.33%)
Mutual labels:  plugin, neovim
Vim Crates
Handle Cargo dependencies like a Rustavimean.
Stars: ✭ 54 (-90.06%)
Mutual labels:  plugin, neovim
Vim Laravel
Vim support for Laravel/Lumen projects
Stars: ✭ 128 (-76.43%)
Mutual labels:  plugin, neovim
Vim Smoothie
Smooth scrolling for Vim done rightπŸ₯€
Stars: ✭ 579 (+6.63%)
Mutual labels:  neovim, smooth-scrolling
Aerojump.nvim
Aerojump is a fuzzy-match searcher/jumper for Neovim with the goal of quick keyboard navigation
Stars: ✭ 184 (-66.11%)
Mutual labels:  plugin, neovim
Vim Subversive
Vim plugin providing operator motions to quickly replace text
Stars: ✭ 168 (-69.06%)
Mutual labels:  plugin, neovim
Vim Dirvish
Directory viewer for Vim ⚑️
Stars: ✭ 929 (+71.09%)
Mutual labels:  plugin, neovim
Gen tags.vim
Async plugin for vim and neovim to ease the use of ctags/gtags
Stars: ✭ 288 (-46.96%)
Mutual labels:  plugin, neovim
Markdown Preview.vim
⚠️ PLEASE USE https://github.com/iamcco/markdown-preview.nvim INSTEAD
Stars: ✭ 764 (+40.7%)
Mutual labels:  plugin, neovim
Sniprun
A neovim plugin to run lines/blocs of code (independently of the rest of the file), supporting multiples languages
Stars: ✭ 93 (-82.87%)
Mutual labels:  plugin, neovim
Gina.vim
πŸ‘£ Asynchronously control git repositories in Neovim/Vim 8
Stars: ✭ 587 (+8.1%)
Mutual labels:  plugin, neovim
Nvim Lspconfig
Quickstart configurations for the Nvim LSP client
Stars: ✭ 3,410 (+527.99%)
Mutual labels:  plugin, neovim
Vim Svelte
Vim syntax highlighting and indentation for Svelte 3 components.
Stars: ✭ 158 (-70.9%)
Mutual labels:  plugin, neovim
Vim Yoink
Vim plugin that maintains a yank history to cycle between when pasting
Stars: ✭ 225 (-58.56%)
Mutual labels:  plugin, neovim
Vimpyter
Edit your Jupyter notebooks in Vim/Neovim
Stars: ✭ 308 (-43.28%)
Mutual labels:  plugin, neovim
Vim Plugins Profile
πŸ•“ Profile Vim's plugins, generate awesome statistics and optimize (n)vim startup time
Stars: ✭ 508 (-6.45%)
Mutual labels:  neovim

comfortable-motion.vim

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 C-d/C-u: Scroll with C-d/C-u

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

Requirements

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.

Installation

For example, with vim-plug:

Plug 'yuttie/comfortable-motion.vim'

Configuration

Please note that the following mappings for <C-d> and <C-u> are not ones for you if you expect they scroll a buffer just half a window.

Scrolling Method

This plugin relies on <C-e> and <C-y> by default to actually scroll a window. You can customize these keys to other combinations like j and k 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. $j. This is because the current implementation prepends the number of scroll amount to the keys, e.g. 5$j, and executes it once per simulation tick.

Keys and Mouse Wheel

By default, the following key mappings are defined.

nnoremap <silent> <C-d> :call comfortable_motion#flick(100)<CR>
nnoremap <silent> <C-u> :call comfortable_motion#flick(-100)<CR>

nnoremap <silent> <C-f> :call comfortable_motion#flick(200)<CR>
nnoremap <silent> <C-b> :call comfortable_motion#flick(-200)<CR>

To prevent the plugin from defining those default key mappings, you can set g:comfortable_motion_no_default_key_mappings 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 <silent> <ScrollWheelDown> :call comfortable_motion#flick(40)<CR>
noremap <silent> <ScrollWheelUp>   :call comfortable_motion#flick(-40)<CR>

You may need to enable the mouse 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 <C-u>/<C-d> (with the default impulse value of -100/100) 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 <silent> <C-d> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 2)<CR>
nnoremap <silent> <C-u> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -2)<CR>
nnoremap <silent> <C-f> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 4)<CR>
nnoremap <silent> <C-b> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -4)<CR>

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].