How do I save only modified files across the argument list in Vim?
Answer
:argdo update
Explanation
When working through an argument list, many files may remain unchanged. Writing all of them with :argdo write can trigger unnecessary file timestamp churn, external watchers, and avoidable merge noise. :argdo update keeps the batch write pass safe by only writing buffers that are actually modified.
How it works
:argdoexecutes an Ex command for every file in the current argument listupdatewrites the buffer only if it has unsaved changes- Unmodified files are skipped automatically
:argdo update
This command is especially useful as the last step after a multi-file refactor where some files matched and others did not.
Example
Suppose your argument list contains three files:
api/user.go
api/team.go
api/audit.go
You run a substitution across all files, but only user.go and audit.go changed. Running :argdo update writes only those two files; team.go is left untouched.
Tips
Pair this with :args or :argadd to control scope precisely. For safer refactors, use :argdo %s/old/new/ge | update so non-matching files do not error and only modified buffers are written.