This is a read-only archive!

Vim arglist

Note to self: If you want to open multiple files in Vim via a glob, you can pass them in on the commandline. They end up in the arglist (see also :h arglist). But once you start Vim, you can also set a new arglist via

:n *glob*

using some glob.

This has the very beneficial side-effect of opening all matching files in Vim buffers. This is the only way I know of to open multiple files via a single command once Vim has started. (May be other ways I don't know of though.)

Once you have an arglist you can do spiffy things with :argdo. For example, search / replace across mulitple files. This is what I needed to do today.

:argdo s/regex/replacement/ | update

Side note, to delete all buffers that currently exist:

:bufdo bd

I find it handy to map that to something in normal mode, because I need to do it so often.

November 19, 2007 @ 12:13 PM PST
Cateogory: Programming
Tags: Vim

1 Comment

Quoth Loevborg on January 17, 2008 @ 9:47 AM PST

Thanks for the last tip! ":bufdo bd" does what ":%bd" does not.