问题
After I make a jump to anywhere in the world, whether in the current file or a different file, is it possible to make vim automatically run zz (re-center on current line)?
I want this after things like search, ctrl-o and ctrl-i ... and pretty much any movement other than hjkl.
Thanks.
回答1:
Voila:
" Center screen on next/previous selection.
nnoremap n nzz
nnoremap N Nzz
" Last and next jump should center too.
nnoremap <C-o> <C-o>zz
nnoremap <C-i> <C-i>zz
来源:https://stackoverflow.com/questions/2372584/auto-zz-in-vim-after-a-jump