How do I pick from multiple tag matches instead of jumping to the first one?
g]
g] is the disambiguation-aware alternative to .
411 results for "G"
g]
g] is the disambiguation-aware alternative to .
<C-v>jjjg<C-a>
Selecting a column of identical numbers with visual block mode and pressing g turns them into an incrementing sequence.
:%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.
:g/pattern/z#.5
The :global command is great for finding lines matching a pattern, but by default it only shows the matching lines themselves.
:set operatorfunc=MyFunc<CR>g@{motion}
Vim's operatorfunc and g@ let you define custom operators that accept any motion or text object, just like built-in operators d, c, and y.
:%S/old/new/g (vim-abolish)
vim-abolish by Tim Pope provides :%S (Subvert), a substitute command that preserves the case pattern of the original text.
:%s/pattern/\=@0/g
The \=@0 replacement expression inserts the contents of register 0 (last yank) as the replacement text.
:s/old/new/g
The :s/old/new/g command replaces all occurrences of old with new on the current line only.
g- / g+
Vim doesn't have a simple linear undo stack — it maintains a full undo tree with branches.
editing #editing #undo-redo #normal-mode #advanced #productivity
:%s/\d\+/\=submatch(0)+1/g
Vim's expression replacement (\=) in substitutions lets you perform arithmetic on matched text.
:set operatorfunc=MyFunc<CR>g@
Vim lets you define custom operators that behave like built-in ones (d, c, y) — they wait for a motion or text object, then act on the selected region.
:s/pattern/\=expression/g
Prefixing the replacement string with \= in a :substitute command tells Vim to evaluate the rest as a VimScript expression rather than literal text.
:'<,'>s/old/new/g
After making a visual selection, you can run a substitute command that only affects the selected text.
:{start},{end} command
Ex commands accept range specifiers that control which lines are affected.
:/start/,/end/command
Vim allows pattern-based ranges in Ex commands, letting you operate on lines between two search matches.
:g/pattern/norm @a
The :g/pattern/norm @a command combines the global command with macro execution.
v{motion}<C-g>
Vim has a lesser-known select mode that behaves like selection in typical GUI editors: any typed character replaces the selection.
<C-v>jjI1. <Esc>
Visual block insert can add numbered prefixes to lines.
:%s/; /;\r/g
In the replacement part, use \r to insert a newline.
:tabdo %s/old/new/g
Use :tabdo to execute a command in every tab page.