How do I run a recorded macro across multiple files at once?
:argdo norm @a | update
Combining :argdo with :norm @a lets you apply a recorded macro to every file in Vim's argument list — a powerful pattern for bulk refactoring across a project
2277 results for "@a"
:argdo norm @a | update
Combining :argdo with :norm @a lets you apply a recorded macro to every file in Vim's argument list — a powerful pattern for bulk refactoring across a project
:let g:debug_macro=1 | normal @a
When a macro doesn't work as expected, debugging it step by step is essential.
: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
A
The A command moves the cursor to the end of the current line and enters insert mode.
:[range]norm @{register}
The :normal command executes normal-mode keystrokes on each line in a range — including macro playback.
:let @a = expand('%:p')
Named registers are not only for yanked text.
registers #registers #command-line #filename-modifiers #editing
<C-a> / <C-x>
Pressing increments and decrements the number under or after the cursor.
:tab {cmd}
Most commands that open a new window (:help, :split, :new, :terminal) open a horizontal split by default.
zf (in visual mode)
In visual mode, pressing zf creates a manual fold from the selected lines.
:g/pattern/normal A;
The :global command combined with :normal lets you execute arbitrary normal mode keystrokes on every line that matches a pattern.
command-line #global #normal-mode #editing #ex-commands #batch-editing
\%l and \%c
Vim's \%l and \%c pattern atoms anchor a search to a particular line number or column, enabling surgical searches and substitutions that standard regex cannot e
:e +{cmd} {file}
The :e +{cmd} {file} form opens a file and executes an Ex command immediately after loading it.
:'<,'>norm! A;
The :normal Ex command lets you execute any Normal mode keystrokes on a range of lines simultaneously, turning a single-line operation into a multi-line batch e
editing #editing #normal-mode #ex-commands #visual-mode #text-manipulation
:redir @a | messages | redir END<CR>
When debugging a session or building repeatable edits, it is useful to turn command output into editable text.
Record worker macro in @b, call it from @a with @b
Complex macros are hard to debug and maintain when crammed into a single register.
<C-r><C-o>a
When you paste multiline snippets from a register while in Insert mode, default insertion can trigger indentation and formatting side effects line by line.
registers #registers #insert-mode #formatting #indentation #editing
mA and 'A
Vim has two tiers of marks.
:Vexplore
Vim ships with netrw, a built-in file explorer that requires no plugins.
:tabnew
Use :tabnew to open a new empty tab, or :tabnew filename to open a file in a new tab.
qa I1. <Esc>j q
This simple macro inserts a list number prefix at the beginning of each line.