How do I remove duplicate entries from the Vim arglist after adding files multiple times?
If you build an arglist incrementally (:args, :argadd, glob expansions), duplicates can sneak in and make :argdo workflows slower or confusing.
category:
command-line
tags:
#command-line
#arglist
#batch-editing
#workflow
How do I run normal mode edits on every line matching a pattern?
The :global command combined with :normal lets you execute arbitrary normal mode keystrokes on every line that matches a pattern.
category:
command-line
tags:
#global
#normal-mode
#editing
#ex-commands
#batch-editing
How do I run the same command across all windows, buffers, or tabs?
:windo / :bufdo / :tabdo {command}
Vim's do commands iterate over collections and execute a command in each context.
category:
buffers-windows
tags:
#buffers
#windows
#tabs
#batch-editing
#ex-commands
How do I apply a macro across multiple files at once?
:argdo normal @q | update
The :argdo command runs a command in every file in the argument list.
category:
macros
tags:
#macros
#batch-editing
#multi-file
#ex-commands
#workflow
How do I prevent a macro from stopping when a command fails?
Use :s/pat/rep/e flag or :silent! prefix
By default, Vim macros abort on the first error — a failed search, a substitute with no matches, or a movement that can't be performed.
category:
macros
tags:
#macros
#error-handling
#ex-commands
#batch-editing
How do I chain multiple commands on lines matching a pattern with :g?
The :g (global) command can execute multiple Ex commands per matching line by chaining them with .
category:
command-line
tags:
#command-line
#global
#ex-commands
#batch-editing
#advanced
How do I run a command on every file in the quickfix list?
:cdo s/old/new/g | update
The :cdo command executes a given command on every entry in the quickfix list.
category:
command-line
tags:
#command-line
#quickfix
#batch-editing
#search
#multi-file
How do I run a macro on every line matching a pattern?
The :global command combined with :normal lets you execute a recorded macro on every line that matches a given pattern.
category:
macros
tags:
#macros
#command-line
#ex-commands
#global
#batch-editing
How do I add text to the end of every line in a range?
The :normal command executes normal-mode keystrokes on every line in a range.
category:
command-line
tags:
#command-line
#ex-commands
#editing
#normal-mode
#batch-editing