Vim Screen Navigation — H, M, L, zz, zt, zb
Position cursor relative to the visible screen with H, M, L. Control scroll position with zz, zt, zb. Master f, F, t, T for character-level line jumps.
Navigation
Detailed Explanation
Screen-Relative Cursor Positioning
These commands move the cursor based on what is currently visible on screen:
| Key | Position |
|---|---|
H |
High — first line of the visible screen |
M |
Middle — middle line of the visible screen |
L |
Low — last line of the visible screen |
View Adjustment
Sometimes you want to scroll the view without changing the cursor position:
| Key | Effect |
|---|---|
zz |
Center current line vertically |
zt |
Move current line to top of screen |
zb |
Move current line to bottom of screen |
Character Search on Current Line
These are among the most useful Vim motions for precise positioning:
| Key | Action |
|---|---|
f{char} |
Jump forward to next occurrence of char on the line |
F{char} |
Jump backward to previous occurrence of char |
t{char} |
Jump forward to just before the char |
T{char} |
Jump backward to just after the char |
; |
Repeat the last f/F/t/T motion forward |
, |
Repeat the last f/F/t/T motion backward |
Practical Examples
f(— Jump to the next(on the line (great for navigating function calls)ct)— Change text from cursor to just before)(change function arguments)df,— Delete from cursor through the next,(delete a parameter)
The f/t motions compose with operators just like any other motion, making them essential for surgical edits.
Use Case
You need precise cursor positioning — either relative to the visible screen area or by jumping to specific characters on the current line for quick edits.