gg / G (top / bottom)
What is gg / G (top / bottom)?
gg / G (top / bottom): Vim: jump to the first line (gg) or the last line (G) of the file. In Vim, gg jumps to the first line of the file and G jumps to the last. A number before G jumps to that line, so 42G goes to line 42. These motions combine with operators like everything else in Vim. dG deletes from the cursor to the end of the file, ggVG selects the whole file, and gg=G re-indents all of it.
Frequently asked questions about gg / G (top / bottom)
What should you keep in mind with gg / G (top / bottom)?
The same keys work in less, which is what man pages and git log use for paging. When you open a long log file in less, G takes you straight to the newest entries at the bottom, and gg back to the top. It is a small habit that makes reading logs on a server much quicker than scrolling.
At a glance
| Category | Keyboard shortcuts |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |