Skip to content

Commit

Permalink
Enable smooth scrolling in Visual mode for neovim
Browse files Browse the repository at this point in the history
Neovim has special <cmd> mapping for this purpose.
See `:help map-cmd` in neovim
  • Loading branch information
subnut committed Nov 1, 2020
1 parent 2bdd74f commit 788dc2b
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions plugin/smoothie.vim
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
nnoremap <silent> <Plug>(SmoothieDownwards) :<C-U>call smoothie#downwards() <CR>
nnoremap <silent> <Plug>(SmoothieUpwards) :<C-U>call smoothie#upwards() <CR>
nnoremap <silent> <Plug>(SmoothieForwards) :<C-U>call smoothie#forwards() <CR>
nnoremap <silent> <Plug>(SmoothieBackwards) :<C-U>call smoothie#backwards() <CR>
if has('nvim')
noremap <silent> <Plug>(SmoothieDownwards) <cmd>call smoothie#downwards() <CR>
noremap <silent> <Plug>(SmoothieUpwards) <cmd>call smoothie#upwards() <CR>
noremap <silent> <Plug>(SmoothieForwards) <cmd>call smoothie#forwards() <CR>
noremap <silent> <Plug>(SmoothieBackwards) <cmd>call smoothie#backwards() <CR>
if !get(g:, 'smoothie_no_default_mappings', v:false)
silent! nmap <unique> <C-D> <Plug>(SmoothieDownwards)
silent! nmap <unique> <C-U> <Plug>(SmoothieUpwards)
silent! nmap <unique> <C-F> <Plug>(SmoothieForwards)
silent! nmap <unique> <S-Down> <Plug>(SmoothieForwards)
silent! nmap <unique> <PageDown> <Plug>(SmoothieForwards)
silent! nmap <unique> <C-B> <Plug>(SmoothieBackwards)
silent! nmap <unique> <S-Up> <Plug>(SmoothieBackwards)
silent! nmap <unique> <PageUp> <Plug>(SmoothieBackwards)
if !get(g:, 'smoothie_no_default_mappings', v:false)
silent! map <unique> <C-D> <Plug>(SmoothieDownwards)
silent! map <unique> <C-U> <Plug>(SmoothieUpwards)
silent! map <unique> <C-F> <Plug>(SmoothieForwards)
silent! map <unique> <S-Down> <Plug>(SmoothieForwards)
silent! map <unique> <PageDown> <Plug>(SmoothieForwards)
silent! map <unique> <C-B> <Plug>(SmoothieBackwards)
silent! map <unique> <S-Up> <Plug>(SmoothieBackwards)
silent! map <unique> <PageUp> <Plug>(SmoothieBackwards)
endif
else
nnoremap <silent> <Plug>(SmoothieDownwards) :<C-U>call smoothie#downwards() <CR>
nnoremap <silent> <Plug>(SmoothieUpwards) :<C-U>call smoothie#upwards() <CR>
nnoremap <silent> <Plug>(SmoothieForwards) :<C-U>call smoothie#forwards() <CR>
nnoremap <silent> <Plug>(SmoothieBackwards) :<C-U>call smoothie#backwards() <CR>
if !get(g:, 'smoothie_no_default_mappings', v:false)
silent! nmap <unique> <C-D> <Plug>(SmoothieDownwards)
silent! nmap <unique> <C-U> <Plug>(SmoothieUpwards)
silent! nmap <unique> <C-F> <Plug>(SmoothieForwards)
silent! nmap <unique> <S-Down> <Plug>(SmoothieForwards)
silent! nmap <unique> <PageDown> <Plug>(SmoothieForwards)
silent! nmap <unique> <C-B> <Plug>(SmoothieBackwards)
silent! nmap <unique> <S-Up> <Plug>(SmoothieBackwards)
silent! nmap <unique> <PageUp> <Plug>(SmoothieBackwards)
endif
endif

0 comments on commit 788dc2b

Please sign in to comment.