28

When I have a tmux window vertically split into two panes, how can i spawn a new third horizontal pane that stretches over the full width?

e.g. How do I get from this:

Ctr-b %

+–––––––––+–––––––––+
|         |         |
|         |         |
|         |         |  
|         |         |
|         |         |
+–––––––––+–––––––––+

to this?

Ctr-b %
Ctr-b ...now what?

+–––––––––+–––––––––+
|         |         |
|         |         |
|         |         |  
|         |         |
|         |         |
+–––––––––+–––––––––+
|                   |
|                   |
+–––––––––––––––––––+

instead of this?

Ctr-b %
Ctr-b "

+––––––––+––––––––––+
|        |          |
|        |          |  
|        |          |
|        |          |
|        |          |
|        +––––––––––+
|        |          |  
|        |          |
+––––––––+––––––––––+

Note: I don't want to cycle through all possible layout combinations via Ctr-b Space to eventually get to the desired layout - it should be achieved with as much brevity as possible.

  • it's amazing that this isn't a solved problem. All of the answers below so far are completely useless and don't address your actual question :-( – rob3c Jun 2 '18 at 20:25
16

You can use one of the five preset layout modes (tiled) to achieve this. From your starting point (a single vertical split), open a new pane, which by default will split the active pane and then arrange the panes into tiled mode:

Ctrlb,Alt5

From man tmux:

M-1 to M-5    Arrange panes in one of the five preset layouts: even-horizontal,even-vertical, main-horizontal, main-vertical, or tiled.

You could optionally add a select-layout tiled to a keybind in your .tmux.conf if this was a layout you wanted regularly.

  • I cried when got to know that tmux has presets after years of using it. – DenisKolodin Jul 23 '18 at 12:14
  • What keys do you press on Mac? Ctrl b, Option 5 is not working for me. – Leo Galleguillos Feb 25 at 22:48
15

Get a newer version of tmux (at least 2.3).

From the man page:

The -f option creates a new pane spanning the full window height (with -h) or full window width (with -v), instead of splitting the active pane.

4

tmux 2.3 supports the -f switch in split-window which does exactly what you are looking for:

The -f option creates a new pane spanning the full window height (with -h) or full window width (with -v), instead of splitting the active pane.

2

If you'd like to spawn a new third horizontal pane that stretches over the full width, I suggest you try this

Ctrl-b "

or to cycle through

Ctrl-b space

  • Thank you for your suggestion. I don't want to cycle through all possible layouts though, but simply spawn a third pane with the desired layout and position. But maybe your suggestion is the only possible solution to achieve this (which I hope it is not :) – jottr Apr 11 '14 at 23:13
  • @elementz did the ctrl-b " double quotes work?? – kmassada Apr 12 '14 at 11:55
  • No. That ctr-b " creates what you can see in my third example above. – jottr Apr 12 '14 at 12:14
1

Ctrl + B then " (double quotes) to split into two horizontal windows

Ctrl + B "o" to switch back to top window (check your cursor, that will tell you where you are)

Ctrl + B then % (shift + 5) to split the top window

That should work with the default key bindings.

  • 4
    Thx for trying to answer my question, but the starting point is NOT a blank slate, but an already vertically split window. – jottr Apr 11 '14 at 23:08
0

Old question but wanted to add, if there is a layout you want to use often you can use

   tmux list-windows

to give you the current layout (this will be a string like c904,273x74,0,0{81x74,0,0[81x29,0,0,1,81x21,0,30,2,81x22,0,52,3],191x74,82,0,0})

Then pass that string to select-layout to apply it. Look for select-layout in the man page for more info.

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.