How to scroll and page down in Vim
In Normal mode, press Ctrl-f to page down and Ctrl-b to page up, or Ctrl-d and Ctrl-u to scroll half a page. zz puts the cursor's line in the middle of the screen.
| Keys | What it does |
|---|---|
| Ctrl-f / Ctrl-b | Page down / page up: a whole screen forwards or backwards. The Page Down and Page Up keys do the same. |
| Ctrl-d / Ctrl-u | Scroll down / up half a screen; the cursor moves the same number of lines. |
| Ctrl-e / Ctrl-y | Scroll one line down / up. The cursor stays on its line unless it would leave the screen. |
| zz | Scroll so the cursor's line is in the middle of the screen. The cursor doesn't move. |
| zt / zb | Scroll so the cursor's line is at the top / the bottom of the screen. |
| H / M / L | The opposite: the page stays put and the cursor goes to the top, middle or bottom line of the screen. |
| 3Ctrl-e | Three lines at once: Ctrl-e, Ctrl-y, Ctrl-f and Ctrl-b all take a count. |
Scroll from memory
Press the keys for each one, as you would in Vim.
A page or half a page?
Ctrl-d and Ctrl-u are the ones most people use for reading. Half a screen is small enough that your eye can follow the text as it moves, and the cursor comes along by the same number of lines, so it stays on what you were reading. Ctrl-f and Ctrl-b turn a whole screen at once, which is faster for skimming a long file but easy to lose your place in.
Often you don't need to scroll at all. If you know where you are going, G with a line number, a search with /, or } to the next blank line gets there in one move, and zz then brings the line into the middle of the screen.
Some lines above and below the cursor
The scrolloff option keeps that many lines visible above and below the cursor, so it never sits right at the edge of the screen: :set scrolloff=8 and ↵, or put set scrolloff=8 in ~/.vimrc (vim.opt.scrolloff = 8 in Neovim's init.lua). Vim's defaults.vim sets it to 5; Neovim starts at 0. A very large value, like 999, keeps the cursor's line in the middle of the screen all the time.