How to move screen without moving cursor in Vim?

Additionally:

  • Ctrl-y Moves screen up one line
  • Ctrl-e Moves screen down one line
  • Ctrl-u Moves cursor & screen up ½ page
  • Ctrl-d Moves cursor & screen down ½ page
  • Ctrl-b Moves screen up one page, cursor to last line
  • Ctrl-f Moves screen down one page, cursor to first line

Ctrl-y and Ctrl-e only change the cursor position if it would be moved off screen.

Courtesy of www.lagmonster.org/docs/vi2.html


  • zz - move current line to the middle of the screen
    (Careful with zz, if you happen to have Caps Lock on accidentally, you will save and exit vim!)
  • zt - move current line to the top of the screen
  • zb - move current line to the bottom of the screen