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 use a set of tabs and splits in my Vim window for my workflow.

My setup looks something like this:

1st tab with a vertical split showing two buffers. 2nd tab in the following split:

-----------------------------------
|                    |            |
|                    |            |
|                    | Buffer b   |
|                    |            |
|                    |            |
|  Buffer a          |------------|
|                    |            |
|                    |            |
|                    | Buffer c   |
|                    |            |
|--------------------|------------|

Now, how can I start vim such that I get all my files loaded as separate buffers in the about layout? I am too lazy to set up this layout everytime I have to restart my vim for some reason.

share|improve this question
    
You also seem to be too lazy to at least look up the excellent Vim help and post your attempts with your question. –  Ingo Karkat Mar 10 at 12:26
    
Ingo Karkat: Not really. I tried, but couldn't find anything about such a feature on Vim help. –  darnir Mar 10 at 12:36

1 Answer 1

up vote 2 down vote accepted

Vim supports the -o and -O arguments to influence the split behavior of passed files. Since only one can be specified, and you want an asymmetic layout, you need to adapt this later, with commands that you can pass via -c {Ex-cmd}.

For your second, more interesting layout, one simple way is to start with horizontal splits, and move the first (buffer a) window to the left with <C-w>H.

$ vim -o -c "wincmd H" a b c

I'll leave the addition of the first tab layout as an exercise to you...

Alternative

If the set of files is fixed (and the layout more complex), Vim sessions (cp. :help Session) store the window layout and set of opened files.

share|improve this answer
    
Yes! Your alternative sounds good. And since my set of files is pretty much fixed, I can use sessions. I didn't know about this feature at all! Thanks a lot! (I'll mark this answer, as soon as I get the sessions working) –  darnir Mar 10 at 12:37
    
Though everything is built-in, I can recommend the session.vim plugin, which simplifies the session handling. –  Ingo Karkat Mar 10 at 13:40

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.