Its all relative
Relative line numbers in Vim are fantastic but won’t work with wrapped lines if you remap
gk respectively… that is, unless you do this:
nnoremap <expr> j v:count ? 'j' : 'gj' nnoremap <expr> k v:count ? 'k' : 'gk'
Thus allowing you to still jump by a count (that’s the
v:count check part) and also move up and down to the visual next line. I haz cake and I eats it.
- //Posted: June 8, 2018
- //Updated: May 30, 2022