How do I re-indent all lines from the cursor to the end of the file in one keystroke?
=G
The =G command applies Vim's auto-indent operator (=) from the current line to the last line of the file (G).
795 results for "G"
=G
The =G command applies Vim's auto-indent operator (=) from the current line to the last line of the file (G).
:g/^/m0
The :g/^/m0 command is a clever use of Vim's global command to reverse every line in the file.
g*
The g command searches forward for the text under the cursor without adding word boundary anchors.
search #search #navigation #normal-mode #motions #productivity
:g/pattern/put ='text'
Combining :global with :put = lets you insert synthesized lines of content after every line matching a pattern — without plugins or complex macros.
g+
Vim's undo history is a tree, not a linear stack.
* then :%s//new/g
Pressing searches for the word under the cursor, which also loads it into the search register.
:%s/\<\w\+\>/\=toupper(submatch(0))/g
The \= flag in the replacement part of :substitute tells Vim to evaluate what follows as a Vimscript expression instead of treating it as a literal string.
<C-g>u
By default, Vim treats an entire Insert mode session (from entering Insert mode to pressing ) as a single undo unit.
:g/pattern/command
The :g/pattern/command (global) command executes an Ex command on every line in the file that matches the given pattern.
:Git command (e.g., :Git status)
vim-fugitive by Tim Pope is a comprehensive Git wrapper for Vim.
:%s/,/\r/g
In Vim's substitute command, \r in the replacement string inserts a newline.
:g/pattern/normal @q
The :global command combined with :normal lets you execute a recorded macro on every line that matches a given pattern.
macros #macros #command-line #ex-commands #global #batch-editing
:%s/\(\w\+\) \(\w\+\)/\2 \1/g
Vim's substitute command supports captured groups (back-references) using \( and \), allowing you to capture parts of a match and rearrange them in the replacem
:g/start/,/end/d
The :g (global) command can operate on ranges, not just single lines.
:%s/\n/ /g
Using \n in the pattern of :substitute matches the newline character at the end of each line, letting you join lines with any separator you choose — something
:s/\v\d+/\=printf('%04d', submatch(0))/g
Substitution expressions let Vim compute each replacement dynamically, which is ideal when plain capture groups are too limited.
:s/,/\r/g
In Vim's substitute command, use \r (not \n) in the replacement to insert a real newline.
:g/^$/,/./-j
The command :g/^$/,/.
:g/pattern/.-1,.+1d
The :g (global) command normally operates on lines that match a pattern.
:g/pattern/t$
How it works The :g (global) command combined with :t (copy) lets you duplicate all lines matching a pattern to a specific location.