Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (25 sloc) 1.19 KB
<h3 id="navigating-the-viewport">Navigating the Viewport</h3>
<h4>Problem</h4>
<p>You want to scroll through a document in <i>screenfulls</i>; not line by
line.</p>
<h4>Solution</h4>
<table>
<tr><th>Command</th> <th>Scroll To</th></tr>
<tr><td><kbd>H</kbd></td> <td>Top of the screen. (Mnemonic:
<i>H</i>ome).</td></tr>
<tr><td><kbd>L</kbd></td> <td>Bottom of the screen. (Mnemonic:
<i>L</i>ower).</td></tr>
<tr><td><kbd>M</kbd></td> <td>Middle of the screen. (Mnemonic:
<i>M</i>iddle).</td></tr>
<tr><td><kbd>gg</kbd></td> <td>Top of file.</td></tr>
<tr><td><kbd>G</kbd></td> <td>Bottom of file.</td></tr>
</table>
<h4>Discussion</h4>
<p>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.</p>
<p>The area of the screen displaying a file is called the <i>viewport</i>. As we
scroll down the document using <kbd>j</kbd>, 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.</p>