I would like to keep my cursor centered at any time.
I manage, thanks to a high valued scrolloff
as mentioned on this Vim Tips page, to keep it centered when there is line around the cursor but I can't make Vim behave that way when my cursor is near the first or last lines. Is it possible to make Vim adds the "tilde" ~
lines to replace "real lines"?
You can try this mapping:
:nnoremap j jzz
:nnoremap k kzz
And if you often use G
to jump to end of a file, you probably also want
:nnoremap G Gzz
Exactly what made kev but if (like me) you're a silly full keyboard user, you can add
:nnoremap j jzz
:nnoremap k kzz
:nnoremap <Down> jzz
:nnoremap <Up> kzz
Thanks to @kev
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