How do I save only modified files across the argument list in Vim?
:argdo update
When working through an argument list, many files may remain unchanged.
command-line #command-line #buffers #ex-commands #refactoring
Search Vim Tricks
Searching...:argdo update
When working through an argument list, many files may remain unchanged.
command-line #command-line #buffers #ex-commands #refactoring
:set undodir^=$HOME/.vim/undo//
If you already have an undodir configured by a distro config or plugin, replacing it outright can remove fallback paths you still want.
5g;
Most users know g; moves backward through the changelist, but fewer people use a count with it.
:let @/ = '\V' . escape(expand('<cword>'), '\')
This pattern lets you prepare a precise search target without jumping the cursor or triggering an immediate search motion.
:lockmarks normal! >>
When you run editing commands from the command line, Vim usually updates special marks like '[ and '] to the changed text.
:let @q .= 'A;<Esc>'
Re-recording a long macro just to add one extra step is slow and error-prone.
:windo setlocal scrollbind
When reviewing related files side by side, manually keeping splits aligned wastes attention.
:let @/ = '\V' .. escape(expand('<cword>'), '\\')
Sometimes * is too opinionated: it uses keyword boundaries and interprets regex metacharacters.
:lvimgrep /\<TODO\>/gj **/* | lopen
If you want project-wide search results without polluting the global quickfix list, use a location list.
:%s/\v(\d+)/\=printf('%04d', submatch(1))/g<CR>
When you need to normalize IDs, ticket numbers, or sequence values, :substitute can do more than plain text replacement.
command-line #command-line #substitute #regex #formatting #ex-commands
vitU
When editing markup-heavy files, you often need to transform only the tag contents while preserving the surrounding structure.
:%s/\v\d+/\=printf('%04d', submatch(0))/g
When you need aligned numeric data for logs, IDs, or generated fixtures, manual edits are slow and error-prone.
:set splitkeep=topline
When you open, close, or resize splits in long files, the visible window region can shift in ways that break your reading flow.
:set jumpoptions+=stack,view
When you jump around large files with and , the default behavior can feel disorienting because your cursor position may return but your viewport context does no
*Ndgn
When you are reviewing repetitive text, you often need to remove one specific match without running a broad substitute.
:set nrformats-=octal\<CR>
If you work with IDs, ticket numbers, or zero-padded counters, Vim's default octal behavior can be surprising.
:keepalt edit path/to/file\<CR>
Experienced Vim workflows often depend on the alternate file (#) for fast toggling with , quick diffs, or two-file review loops.
:ldo s/foo/bar/ge | update\<CR>
:ldo is one of the most effective ways to perform targeted, multi-file edits without touching unrelated text.
:lvimgrep /TODO/j **/* | lopen\<CR>
When you are working in multiple windows, quickfix can become noisy because it is shared globally across the editor session.
:g/./t.\<CR>
The :global command can apply an Ex action to every line that matches a pattern.