Vim Recipes ‣ Navigation ‣ Navigating the Viewport
You want to scroll through a document in screenfulls; not line by line.
| Command | Scroll To |
|---|---|
| H | Top of the screen. (Mnemonic: Home). |
| L | Bottom of the screen. (Mnemonic: Lower). |
| M | Middle of the screen. (Mnemonic: Middle). |
| gg | Top of file. |
| G | Bottom of file. |
If your file is longer than the height of your window, you'll need a way of scrolling the portion that appears on the screen.
The area of the screen displaying a file is called the viewport. As we scroll down the document using j, the viewport updates to hide the line at the top, and show a new one at the bottom. Scrolling through a long document this way is inefficient and unhealthy for our fingers. Instead we can scroll one screenfull at a time, which severely reduces the amount of key presses involved.