Vim – Multiple Files

One of the very cool things about Vim is the ease of editing multiple files. I like to use this capability when working on a website project and need to update lots of html files with something common, like a new link. Sure, sometimes there are other methods of doing this, like a simple command line search and replace perl script . Sometimes though, the regular expression is just too much of a pain to write, and it’s just easier, and faster, to edit all of the files.

The difficulty is, without menus, it can be tough to remember the syntax to move between files. In case you, like me, can’t remember how to edit multiple files, here is a little tutorial.

  1. Open multiple files with vim vim *.html
  2. Edit the first file
  3. Type :bn to move to the next file in the buffer
  4. Repeat

If you need additional command information, check out this great list of vim tips.

Learning the vi and Vim Editors

Bob Weber

My name is Bob Weber and I live in Greeley Colorado. This blog is my personal views, ideas, comments, etc.. You will probably learn more about me by reading the entries here than you will in this bio.