Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've got four files a b c d and would like to open them all in vim such that I have two tabs each vertically splitted into two windows; files a and b in the first tab and c and d in the second tab. Can I do this from command line?

I know there are -p and -O parameters, but they don't seem to cooperate. One only overwrites another from what I observed...

share|improve this question

2 Answers 2

up vote 1 down vote accepted

This command does what you want:

$ vim -c "edit a|split b|tabedit c|split d"

or, with shortened commands:

$ vim -c "e a|sp b|tabe c|sp d"
share|improve this answer
    
That's what I was looking for. Thank you very much. :) –  Sventimir May 26 at 7:30

You should be able to open your files vertically splitted like this:

vim -O fileA.txt fileB.txt
vim -O fileC.txt fileD.txt

There are also some keys you can use for splitting.
Ctrl-W s for horizontal splitting
Ctrl-W v for vertical splitting
Ctrl-W q to close one

But you should know that different Vim instances have independent sessions.
Currently vim does not support to have seperate toplevel’ windows for the same process/session. It's on the ToDo list. (See :help todo and search for "top-level".)

Perhaps the following will brings you further, if you need to share the same buffer between multiple instances of vim: gnu screen - Working with vim on multiple monitors

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.