views:

74

answers:

3

In vim you can edit multiple files when you launch, a la:

$ vim file1 file2 file3

Then you can edit each file one after the other.

What I would like to do is have file1, file2, and file3 all open up in different buffers, like they would if I did $ vim, :split file1, :split file2, :split file3

Is this possible?

I'd also settle for being able to run a command on entry that would split the files (as seen with :ls) into different windows, that would also work.

(Interesting and mostly unrelated side note - I didn't mention emacs anywhere in the title and SO told me the question appears subjective ;)

A: 

I know you said, "from the command line", but you can use Ctrl-w s to split the window once vim is already open, in case it helps. You can then use Ctrl-w {arrow} to move between the window areas, and :bN/:bn to move between the buffers.

Curtis
Actually in my vimrc I have `map <C-j> <C-w>j<C-w>_` and the `k` equivalent - along with `set winminheight=0`. Then I just use ctrl+k/j to move (and maximize) up and down windows. And on the occasion I need to see more than one buffer, C-w =
Wayne Werner
+2  A: 

vim -c ":vsp file1" -c ":vsp file2" file3

ryancammer
and and replace vsp with sp for horizontal splits (which I prefer)
Wayne Werner
or use horizontal splits. and yeah the -c flag ain't pretty, but it works.
ryancammer
+6  A: 

Look at the -o and -O flags (vim --help).

Daenyth
Ah! That's /much/ better than the -c flag! I *swear* I looked through vim --help (and google) but couldn't find the right command. I guess my google-fu has failed today :P
Wayne Werner