9

I have three vertically split windows. I want the leftmost window to remain as it is, but move the two other windows from a vertical to a horizontal split. How can I achieve this?

I want to get from

----------------
| b1 | b2 | b3 |
|    |    |    |
|    |    |    |
----------------

to

----------------
| b1   | b3    |
|      |-------|
|      | b2    |
----------------

I can't figure out how to do this with the CTRL-W maps listed in :h window-moving. The only thing I could think of involves opening and closing windows, not moving them, and before I create a mapping or command for it I wanted to ask if there isn't a way to do it by window movement. Here's what I've got:

  1. :spl - split middle window
  2. :b 3 - open the buffer from the rightmost window in the new split
  3. CTRL-W+l - move cursor to rightmost window
  4. CTRL-W+c - close current (rightmost) window
jjaderberg
  • 3,489
  • 1
  • 14
  • 19
  • Related question: http://vi.stackexchange.com/questions/1874/how-can-i-get-my-windows-back-into-a-grid-formation. – toro2k Apr 16 '15 at 13:32

1 Answers1

10

I don't know if it is the best way to do what you want, but you can accomplish this only with window movements by doing (start from the rightmost window b3):

1 - CTRL-W+K - You'll have:

----------------
| b3           |
|------|-------|
|b1    | b2    |
----------------

2 - Go to b1 with CTRL-W+j

3 - CTRL-W+H to move b1 to the left.

You should have the layout you want now. The only downside I see with this method is that size and position of b1 are changed temporarily during the movement.

Guilherme Costa
  • 116
  • 1
  • 4