Vim Tips Wiki
Register
Advertisement
Tip 919 Printable Monobook Previous Next

created April 28, 2005 · complexity basic · author Raj Kiran Grandhi · version 5.7


Using 'gj' and 'gk' instead of just 'j' and 'k' allows moving down and up by screen lines instead of file lines. Here are a few nifty mappings for that:

:noremap <Up> gk
:noremap! <Up> <C-O>gk
:noremap <Down> gj
:noremap! <Down> <C-O>gj
" the following are optional, to move by file lines using Alt-arrows
:noremap! <M-Up> <Up>
:noremap! <M-Down> <Down>
:noremap <M-Up> k
:noremap <M-Down> j

Comments[]

See:


Advertisement