How do I delete all lines matching my last search pattern without retyping it?
:g//d
:g//d uses an empty pattern in the global command, which instructs Vim to reuse the last search pattern.
:g//d
:g//d uses an empty pattern in the global command, which instructs Vim to reuse the last search pattern.
:g/^/m0
The :g/^/m0 command is a clever use of Vim's global command to reverse every line in the file.
:g/pattern/normal @a
The :g (global) command combined with :normal @a lets you execute a recorded macro only on lines matching a pattern.
macros #macros #ex-commands #global-command #editing #automation
:g/pattern/yank A
The :g command combined with yank A (uppercase A to append) lets you collect every line matching a pattern into a single register without overwriting previous c
command-line #editing #ex-commands #global-command #registers #filtering