Auto 'zz' in vim after a jump

蓝咒 提交于 2019-12-07 02:57:48

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!