How do I scroll a full page up or down in Vim?
Answer
<C-f> to scroll forward, <C-b> to scroll backward
Explanation
How it works
Vim provides two commands for scrolling by an entire screen (page) at a time:
- Ctrl-F (Forward) scrolls the view one full page down through the file. The cursor moves along with the screen.
- Ctrl-B (Backward) scrolls the view one full page up through the file.
These are distinct from Ctrl-D and Ctrl-U, which scroll by half a page. When you need to move quickly through a large file, full-page scrolling covers twice the distance per keystroke.
After scrolling, the cursor is placed on the first non-blank character of the new top line (for Ctrl-F) or the new bottom line (for Ctrl-B). Vim keeps a two-line overlap between pages so you do not lose your reading context.
Example
Suppose you are reading through a 2000-line log file and want to scan for a particular entry:
- Press
Ctrl-Fto jump forward by a full page. Each press moves you roughly one screenful of lines. - Press
Ctrl-Bto go back one page if you overshot. - Use a count for faster movement:
5Ctrl-Fscrolls forward five full pages at once.
Comparison with half-page scrolling
| Command | Distance |
|---|---|
| Ctrl-F | Full page down |
| Ctrl-B | Full page up |
| Ctrl-D | Half page down |
| Ctrl-U | Half page up |
For reading code or documentation, half-page scrolling often feels more natural because it preserves more context. But for quickly skipping through large sections, full-page scrolling is the faster choice.