2

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...

2 Answers 2

2

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"
1
  • That's what I was looking for. Thank you very much. :)
    – Sventimir
    May 26, 2014 at 7:30
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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