You're likely to be familiar with commands to scroll through the contents like Ctrl followed by d or f or u or b.

Did you know that Vim also has handy options to keep the cursor on the current line while moving the contents around?

  • zz reposition the current line to the middle of the visible window
    • useful to see context around lines that are nearer to the top/bottom of the visible window
  • zt reposition the current line to the top of the visible window
  • zb reposition the current line to the bottom of the visible window

info See :h 'scrolloff' option if you want to always show context around the current line.

Video demo:


info See also my Vim Reference Guide and curated list of resources for Vim.