from–https://stackoverflow.com/questions/9592969/how-to-join-two-tmux-windows-into-one-as-panes
170
I have two tmux windows, with a single pane in each, and I would like to join these two panes together into a single window as a horizontal split panes. How could I do that?
2 Answers
259
Actually I found the way to do that. Suppose the two windows are number 1 and 2. Use
join-pane -s 2 -t 1
This will move the 2nd window as a pane to the 1st window. The opposite command is break-pane
- 48Actually
join-pane
is to move one pane into another, not to move window.join-pane -s 2 -t 1
does not put two windows side by side, but two panes instead. It’s just that the windows happen to have only one pane each. If you have two windows both of which have multiple panes, to put two of panes, say they are pane0.0
and1.0
, side by side, you can: 1) create a new window 2) move pane0.0
to pane2.0
3) move pane1.0
to pane2.0
4) kill pane2.0
. Pane0.0
means the 0th pane of the 0th window.– Hong - 2As already said by @Hong the answer solves the issue but the explanation is incorrect. Two windows can be joined and will result into 1 window splitted into 2 panes. And the example of window numbers can also confuse ppl because as the question is made there is no mention of a third window so to put it correctly it should be window number 0 and 1 (tmux starts always with window 0) Maybe the OP could change the question aswell the answer that way that the question will be re-opend and the answer is correctly formulated. But that is my opinion.– Charles
- 23
- 2@IshanKhare this is good shortcut: unix.stackexchange.com/a/14301/337677
- 1One thing to note that this doesn’t work if you’re already on the mentioned 2nd window.– Hritik
12
Alternatively, if you don’t want to specify the window names when calling join-pane
, you can also mark the pane you want to join into the current window.
Let’s say you want to move a pane from window 2 to window 1. Here’s how to do it:
- Switch to window 2.
- Mark the desired pane with Prefixm.
- Switch to window 1.
- Call
join-pane
: Prefix:join-pane
Aug 7, 2015 at 20:01