When run with no arguments, the :args command reveals the contents of the arglist. But when a valid {arglist} is passed to the :args command it sets the contents of the arglist:
| Ex command | effect |
|---|---|
:args |
show the contents of the arglist |
:args {arglist} |
set the contents of the arglist |
The {arglist} could be:
- one or more filepaths (separated by whitespace)
- a wildcard
- a backtick expression
- a combination of the above
As a general rule: anything that you can provide as an argument to the Vim executable at the commandline can also be supplied as an argument to the :args command.
Backtick expression are particularly powerful. In the video, I use the simple example of running :args `cat .toc` to use the contents of a plaintext file to populate the arglist, but we could put anything inside that backtick expression. So long as the subshell returns a list of filepaths, then Vim will consider it as valid input. For example, you could use the output of find or grep, or even a shell script of your own.