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

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

Related posts:

  1. Slackware 12 upgrade – vim backup files Since upgrading to Slackware 12 I’ve noticed vim creates backups...
  2. Removing smartquotes from text in Linux When converting documents from customer word format to html it...
  3. Bash Tutorial OK, this one is for the techies out there. Found...