Vim Tips Wiki

Moving by screen lines instead of file lines

Redirected from VimTip919

1,623pages on
this wiki
Add New Page
Add New Page Talk0
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



Also on Fandom

Random Wiki