How do I jump to the Nth line from the top or bottom of the visible screen using a count with H and L?
Answer
{count}H and {count}L
Explanation
Most Vim users know H jumps to the first visible line, M to the middle, and L to the last. What fewer know is that H and L both accept a count prefix: {N}H jumps to the Nth line from the top of the visible screen, and {N}L jumps to the Nth line from the bottom. This gives precise, screen-relative navigation without counting or using line numbers.
How it works
H— jump to the first line of the visible screen (Home){N}H— jump to the Nth line from the top (counting from 1)L— jump to the last visible line{N}L— jump to the Nth line from the bottom (counting from 1)M— jump to the middle of the visible screen (no count variant)
The count begins at 1, so 1H equals plain H and 1L equals plain L.
Example
If your screen currently shows lines 80–130:
Line 80 ← H (or 1H)
Line 82 ← 3H
Line 105 ← M
Line 128 ← 3L
Line 130 ← L (or 1L)
Tips
- Combine with operators:
d5Hdeletes from the current line to 5 lines from the top y3Lyanks from the current line down to 3 lines from the bottom- Useful when you can see the target line and want to jump there without
:Nor counting - After jumping,
zzrepositions the view if needed - See
:help Hand:help Lfor full documentation