9

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.

1 Answer 1

8

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

1
  • 1
    Session idea is a good suggestion. Also, sessions can be loaded via command line using -S option. Aug 23, 2012 at 23:46

You must log in to answer this question.

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