Cheat Logo

Cheat Sheet

Line by Line movement

Level: Intermediate
OS:
  • Windows
  • OS X
  • Linux
  • BSD
  • Solaris
Programs:
  • vim

If you dislike vim jumping over all lines when you have a line that wraps, use gk and gj to move up and down. If you want to map these to the up and down arrows, add the following two lines to your .vimrc file:

nnoremap <up> gk
nnoremap <down> gj

Fortunately, doing this does not make it so that gk and gj are inserted when in insert mode. Up and down return to their normal mode.

To have up and down have the same behavior in insert mode add the following to your .vimrc file:

inoremap <up> <C-o>gk
inoremap <down> <C-o>gj
©2015 Schutt Design (Luke & Noel Schutt).
Contact us using one of our first names at schuttdesign dot net.