DELAPARRA
Index
Color
NL
Category: Keyboard shortcuts

gg / G (top / bottom)

Explained by Updated

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.

Definition source Coders Lingo, CC BY 4.0

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

CategoryKeyboard shortcuts
Explained by
Updated

More Keyboard shortcuts terms

All terms starting with G

Skills

Manuals

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.