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.
Exit Vim Using a Shortcut Key To save a file in Vim and exit, press Esc > Shift + ZZ. To exit Vim without saving, press Esc > Shift + ZX.
Remember, yo undo a change in Vim / Vi use the command u , and to redo a change which was undone use Ctrl-R .
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With