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
- zz Line 40 near the middle · cursor unchanged
- zt Line 40 near the top · cursor unchanged
- 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
- Keep the cursor on the line you want to read.
- Press zz to center it.
- Use zt for the top or zb for the bottom.