How do you yank the entire file contents into a register?
gg"aVGy
Go to the first line with gg, then visually select from there to the last line with VG, and yank into register a.
45 results for "gg"
gg"aVGy
Go to the first line with gg, then visually select from there to the last line with VG, and yank into register a.
gg
The gg command moves the cursor to the first line of the file.
gg=G
The gg=G command re-indents every line in the current file according to Vim's indentation rules.
:keepjumps normal! gg=G
Bulk formatting commands are common in cleanup sessions, but they often leave side effects in your navigation history.
:keepjumps normal! gg
Sometimes you need to make a quick structural move (for example, jump to top, inspect context, then return) without polluting jump navigation history.
:execute "normal! gg=G"<CR>
:execute lets you build and run Ex commands dynamically, which is critical when a command depends on variables, conditionals, or string composition.
command-line #command-line #ex-commands #normal-mode #automation
:keepjumps normal! gg=G<CR>
Whole-buffer reindent is common, but doing it naively can pollute your jumplist and break navigation flow during review.
:set equalprg={program}
The equalprg option replaces Vim's built-in = indentation operator with any external formatting program.
:keepjumps {command}
The :keepjumps modifier lets you run any movement or command without recording a new entry in the jump list.
navigation #navigation #ex-commands #jump-list #normal-mode #vimscript
ggVG
While Vim doesn't have a built-in "entire buffer" text object, the ggVG sequence achieves it: go to the first line, enter line-wise visual mode, then select to
:set equalprg=gofmt
By default, Vim's = operator re-indents text using its internal rules.
config #config #editing #ex-commands #formatting #indentation
:keepjumps {cmd}
:keepjumps is a command modifier that suppresses any jump list updates caused by the command that follows it.
qq{actions}@qq
A recursive macro ends by calling itself, so it loops automatically without you pressing @q repeatedly.
>G
The >G command applies a right-indent shift to every line from the cursor through the last line of the buffer.
<C-w>N
When using Vim's built-in :terminal, the buffer is in Terminal-Job mode by default, meaning all keystrokes go to the running shell.
<C-v>jj$A;
Visual block mode normally selects a fixed-width column, which makes appending tricky when lines have different lengths.
=G
The =G command applies Vim's auto-indent operator (=) from the current line to the last line of the file (G).
:set nostartofline
By default, many Vim movement commands — gg, G, Ctrl-d, Ctrl-u, Ctrl-f, Ctrl-b, and others — snap the cursor to the first non-blank character of the destina
<C-o> / <C-i>
Vim maintains a jumplist — a history of every "jump" you make (searches, marks, gg, G, %, etc.
==
The == command auto-indents the current line based on the surrounding context.