Vim Recall繁體中文

Reposition the view around a line

zz or zt or zb

Example

Normal mode on line 40, away from file edges. Window has room to scroll.

Before
Cursor: line 40, near a window edge

  1. zz Line 40 near the middle · cursor unchanged
  2. zt Line 40 near the top · cursor unchanged
  3. zb Line 40 near the bottom · cursor unchanged

After
After zz: line 40 near the middle After zt: line 40 near the top After zb: line 40 near the bottom

Details & Vim help

Place the current line at the middle, top, or bottom of the window.

Create reading space around code without finding the line again.

These scroll the view and keep the cursor’s column. Window edges and scrolloff can limit the exact placement.

Only the viewport scrolls. The cursor’s line and column stay the same, subject to window and scrolling limits.

Try it in Vim

  1. Keep the cursor on the line you want to read.
  2. Press zz to center it.
  3. Use zt for the top or zb for the bottom.