I know how to use both the options:

vim -p bit.c bit.h byte.c byte.h --> it opens these files in 4 different tabs.

vim -O bit.c bit.h byte.c byte.h --> it opens these files splitting the window in 4 parts.

But I would like to group the .c and the correspondent .h files on the same tab doing something like

vim -p -O2 bit.c bit.h byte.c byte.h vec_byte.c vec_byte.h

to open 3 tabs:

the first one with the files bit.c bit.h splitting the the window

the second with the files byte.c byte.h splitting the the window

and the third with with the files vec_byte.c vec_byte.h

Does somebody here know to do it?

Thank you very much.

1 Answer 1


It can be done, but it isn't very nice:

vim -p bit.h byte.h -c 'vsplit bit.c | tabnext | vsplit byte.c'
  • Thank you for aswering. I have searched it, and I didn't find anything yet. At least, your solution works, even if it is not very elegant... So, I think I'll accept it. Commented Aug 24, 2015 at 20:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .