editing multiple files with vim

Recently I accidentally had vim open two files for me, simultaneously. This is when I realized I’ve been doing things all wrong. Until now, in order to work on a site, I’d flip back and forth between GNU screens in order to edit a css file and html file at the same time. This is what I’ve learned:

Start vim with multiple files:

vim ./file1 /file/path/file2 file3

This will bring up vim for you so you can begin editing the first file

Get a listing the files you’ve opened:

:ar
[./fil1]   /file/path/file2   file3

After some editing on the first file, move on to the next:

:n or :next

and back to the previous file in the list:

:p or :prev

and back to the first file in the list:

:rew

Next, I’d like to figure out how to properly open additional files you forgot to include in the first command (above). For this I tried:

:vi ./newfile

However, once this ^ is done, the :ar command doesn’t seem to reflect well. I can only assume this is due to me not reading the manual — so I’ll have to wait on this one.

Any suggestions?

  1. No comments yet.

  1. No trackbacks yet.