How do I keep an argument list change local to the current window?
Answer
:arglocal
Explanation
By default, Vim's argument list is global, so changing it in one window can unexpectedly affect another workflow in a different tab or split. :arglocal gives the current window its own argument list, which is useful when you want focused batch operations without disturbing the rest of your session. This becomes especially powerful when combining :argdo, :next, and quick navigation in side-by-side tasks.
How it works
:arglocal
:arglocaldetaches the current window from the global argument list- After that,
:args,:argadd,:argdelete, and:argdoapply only to this window's local list - Other windows continue using their existing argument list unchanged
This lets you run targeted refactors or checks in one window while keeping another window's file queue intact.
Example
Window A (global args): app/*.js
Window B (global args): app/*.js
In Window B run :arglocal, then :args tests/**/*.js
Result
- Window A still cycles through app/*.js
- Window B now cycles through tests/**/*.js
Tips
- Run
:argsafter:arglocalto confirm the local list contents - Pair with
:argdofor scoped, repeatable edits in just one window context - If you want to return to shared behavior, use
:argglobal