nvim: Drop easymotion

We use easymotion primarily for vertical motion and any motion requires
at least 3 or 4 key bindings which isn't necessarily different if we are
using relative numbers. For example, pressing <Leader>j and then
pressing another one or two keys for the vertical movement is the same
number of keys while using relative numbers. So just use relative
numbers and drop it. We also never used the word and character motions
or cross window motions.

Use f,F,t,T for horizontal line motions. Use clever-f for this, which
improves the default behaviour. For any other motion not covered by
these two, just use incsearch.

While at it, move some of the key bindings to after/plugin to have
key bindings specific to a plugin in it's own file.

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2020-05-10 18:18:08 +05:30
parent fee71ae71e
commit 3c0e1088ad
6 changed files with 17 additions and 46 deletions

View file

@ -0,0 +1,4 @@
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)

View file

@ -0,0 +1,9 @@
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
map n <Plug>(incsearch-nohl-n)
map N <Plug>(incsearch-nohl-N)
map * <Plug>(incsearch-nohl-*)
map # <Plug>(incsearch-nohl-#)
map g* <Plug>(incsearch-nohl-g*)
map g# <Plug>(incsearch-nohl-g#)

View file

@ -32,6 +32,7 @@ set undofile " Enable undo persistence across sessions
set hidden set hidden
set noautochdir set noautochdir
set hlsearch set hlsearch
set relativenumber
" Wild menu " Wild menu
set wildmenu set wildmenu

View file

@ -2,10 +2,9 @@ call plug#begin('~/.config/nvim/plugged')
" Tab completion " Tab completion
Plug 'ervandew/supertab' Plug 'ervandew/supertab'
" EasyMotion " Motions
Plug 'easymotion/vim-easymotion'
Plug 'haya14busa/incsearch.vim' Plug 'haya14busa/incsearch.vim'
Plug 'haya14busa/incsearch-easymotion.vim' Plug 'rhysd/clever-f.vim'
" Fuzzy search " Fuzzy search
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'
" Remove extraneous whitespace when edit mode is exited " Remove extraneous whitespace when edit mode is exited

View file

@ -161,48 +161,6 @@ noremap <Right> <NOP>
nnoremap <silent> <Leader> :<C-U>WhichKey '<Space>'<CR> nnoremap <silent> <Leader> :<C-U>WhichKey '<Space>'<CR>
nnoremap <silent> <LocalLeader> :<C-U>WhichKey ','<CR> nnoremap <silent> <LocalLeader> :<C-U>WhichKey ','<CR>
" Bindings for easy motion
" Character motions
map <Leader><Leader>c <Plug>(easymotion-bd-f)
nmap <Leader><Leader>c <Plug>(easymotion-overwin-f)
" Line motions
map <Leader><Leader>L <Plug>(easymotion-bd-jk)
nmap <Leader><Leader>L <Plug>(easymotion-overwin-line)
" Word motions
map <Leader><Leader>w <Plug>(easymotion-bd-w)
nmap <Leader><Leader>w <Plug>(easymotion-overwin-w)
" Line motion jump
map <Leader>l <Plug>(easymotion-lineforward)
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
map <Leader>h <Plug>(easymotion-linebackward)
" Incremental search + easymotion
noremap <silent><expr> / incsearch#go(<SID>incsearch_config())
noremap <silent><expr> ? incsearch#go(<SID>incsearch_config({'command': '?'}))
noremap <silent><expr> g/ incsearch#go(<SID>incsearch_config({'is_stay': 1}))
" Incremental search
map n <Plug>(incsearch-nohl-n)
map N <Plug>(incsearch-nohl-N)
map * <Plug>(incsearch-nohl-*)
map # <Plug>(incsearch-nohl-#)
map g* <Plug>(incsearch-nohl-g*)
map g# <Plug>(incsearch-nohl-g#)
" Tag helpers " Tag helpers
nnoremap <C-\> :vsp <CR>:exec("tag ".expand("<cword>"))<CR> nnoremap <C-\> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
nnoremap <A-]> :sp <CR>:exec("tag ".expand("<cword>"))<CR> nnoremap <A-]> :sp <CR>:exec("tag ".expand("<cword>"))<CR>
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
function! s:incsearch_config(...) abort
return incsearch#util#deepextend(deepcopy({
\ 'modules': [incsearch#config#easymotion#module({'overwin': 1})],
\ 'keymap': {
\ "\<CR>": '<Over>(easymotion)'
\ },
\ 'is_expr': 0
\ }), get(a:, 1, {}))
endfunction

View file

@ -73,7 +73,7 @@ let g:grepper.switch = 0
let g:grepper.append = 0 let g:grepper.append = 0
let g:grepper.prompt = 0 let g:grepper.prompt = 0
" Easymotion incsearch " Incremental search
let g:incsearch#auto_nohlsearch = 1 let g:incsearch#auto_nohlsearch = 1
" Buftabline " Buftabline