How do I scroll the screen up by one line without moving the cursor?
Answer
<C-y>
Explanation
The <C-y> command scrolls the window up one line at a time while keeping the cursor position fixed. It is the counterpart to <C-e>.
How it works
<C-y>scrolls the viewport up by one line- The cursor stays on its current line unless it would go below the visible area
- Accepts a count:
5<C-y>scrolls up 5 lines
Example
If the window shows lines 20-50, pressing <C-y> changes the view to lines 19-49 while the cursor stays in place.
Tips
- Best used when you want to peek at the line above the viewport
- Pair with
<C-e>for fine-grained scrolling - Does not create jump list entries