36

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
20

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.

| improve this answer | |
  • 1
    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 '19 at 22:48
19

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.

| improve this answer | |
  • good answer, but an example or two would be most illustrative – dbkeys Aug 7 '19 at 13:28
13

tmux 2.3 supports the -f switch in split-window which does exactly what you are looking for (check man here):

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.

For example, in your case:

1) ctrl-b %

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

2) ctrl-b :splitw -fv

Note that after ctrl-b :, you will be typing in the tmux command-prompt (look at the bottom bar).

+–––––––––+–––––––––+
|         |         |
|         |         |
|         |         |  
|         |         |
+–––––––––+–––––––––+
|                   |
|                   |
|                   |
+–––––––––––––––––––+
| improve this answer | |
4

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

| improve this answer | |
  • 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
3

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.

| improve this answer | |
  • that's a great supplement! – user2297550 Jul 17 '19 at 9:13
2

I wound up here looking for a way to move an existing pane to the left, right, top, or botton of the terminal and span the full height or width.

If anyone else ends up here looking for the same thing, the solution is to use split-window, swap-pane, and then kill-pane together.

For example, add this to your .tmux.conf file:

# Pane moving
bind S-Left  split-window -hbf \; swap-pane -t ! \; kill-pane -t !
bind S-Right split-window -hf  \; swap-pane -t ! \; kill-pane -t !
bind S-Up    split-window -bf  \; swap-pane -t ! \; kill-pane -t !
bind S-Down  split-window -f   \; swap-pane -t ! \; kill-pane -t !

Then you can use ctrl+b, shift+left to move the current pane to the left side of the terminal, spanning its full height.

| improve this answer | |
  • I prefer, UDLR, but these work great. – Jess May 7 at 20:45
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.

| improve this answer | |
  • 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

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.