How do I reverse the order of all lines in a file?
:g/^/m0
The :g/^/m0 command is a clever use of Vim's global command to reverse every line in the file.
: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