Tip 38Group Buffers into a Collection with the Argument List

The argument list is easily managed and can be useful for grouping together a collection of files for easy navigation. We can run an Ex command on each item in the argument list using the :argdo command.

Let’s start by opening a handful of files in Vim:

=> $ cd code/files/letters
=> $ vim *.txt
<= 5 files to edit

In Tip 37, we saw that the :ls command provides a listing of buffers. Now let’s examine the argument list:

=> :args
<= [a.txt] b.txt c.txt. d.txt e.txt

The argument list represents the list of files that was passed as an argument when we ran the vim command. In our case, we provided a single argument, *.txt, but our shell expanded the * wildcard, matching the ...

Get Practical Vim, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.