Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know I can open files in multiple tabs with:

vim -p file1 file2 ...

and I know I can open files in a vertical split with:

vim -O file1 file2 ...

Is there a simple way to open vim using both tabs and split views. For example tab1 has file1 and file2 split vertically and tab2 has file3 and file4 split vertically.

share|improve this question
up vote 6 down vote accepted

It's possible using -p to make the tabs and then -c vs to make the vertical split.

$vim -p file2 file4 -c 'vs file1' -c 'tabn' -c 'vs file3'

does what you wanted in your example, but it's a mess of a command to type and you have to list the file you want to end up on the right of the split first which seems backwards to me.

You probably want to look into :help mksession to save the current session to a file and then load it with :source [file] to reload it. It's easier then that monster of a command line and you could even do it from the command line. $vim -c 'source session.vim

I got the idea for the solution from vim_use and the specifics from

:help tabpage
:help windows
:help starting

As a side note, I love using full tab help pages in vim like this tab help windows

share|improve this answer
Session idea is a good suggestion. Also, sessions can be loaded via command line using -S option. – AnonymousLurker Aug 23 '12 at 23:46
Thanks, mksession is exactly what I was looking for. – Kara Aug 24 '12 at 0:03

Your Answer


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.