How do I move an existing pane into another window in tmux when I have multiple windows, and vice versa?
I'm coming from screen, where I can switch to the pane and then switch windows until I get to the one I want; tmux does not seem to allow this.
|
How do I move an existing pane into another window in tmux when I have multiple windows, and vice versa? I'm coming from screen, where I can switch to the pane and then switch windows until I get to the one I want; tmux does not seem to allow this. |
||||
|
|
|
The command to do this is
To simplify this, I have these binds in my
The first grabs the pane from the target window and joins it to the current, the second does the reverse. You can then reload your tmux session by running the following from within the session:
|
|||||||||||||||||||||
|
|
join-pane is the answer. I too was having problems with my attempts to use it based on the tmux documentation. I discovered that the -t and -s switches seem to accept [session]:window and not [session:]window. That is to say that specifying the session is optional, but including the : is mandatory. (I am using tmux 1.5) Therefore, in order to add a pane to the current window and place window 1 into the pane, the command would be (Ctrl-B or whatever your bind key is, followed by)...
You can then break them appart with break-pane which by default is: Ctrl-B ! If you want to bind it to a shortcut, I suggest NOT overriding a default binding like s, because down the road you will look on the internet for an answer that involves choose-session and it will not work on your system. Notice that break-pane is bound to ! and @ is right next to it and not bound to anything by default. For that reason I suggest this binding...
The most important thing is that your LEARN "join-pane -s :" because if you just set it and forget it, you will be gimped when you find yourself on a foreign server. And let's face it, the most important thing a terminal multiplexer gives you is reliable sessions on remote servers. This completes my conversion from GNU Screen to Tmux. I'll never look back. Enjoy! |
|||||||||||||
|
|
I think I like what I've been using for moving panes to their own window better. I use
I figured it out through experimentation, but it seems to work very well. You can keybind or alias it easily, no scripting required. |
|||||
|
|
If you don't want to type the pane identifier into a prompt, you can also use
which will join the last active pane/window to the current window. |
|||
|
After looking through the other answers and perusing the tmux man page I settled on the following bindings for now:
This will let you interactively select the window to join, and mirrors my lowercase |
|||
|
|
|
You don't have to change your key bindings. Whilst the pane you wish to move has focus, type Prefix then Add an |
|||
|
|