221

I know that it's possible in tmux to join a window as a pane, but is it possible to move a pane to it's own window (tab)? I tried searching it up the man page but couldn't find it. I guess it is possible doing it through a shell script, but is there some other, more elegant way?

Mateusz Piotrowski
  • 4,016
  • 4
  • 28
  • 53
Mikey S.
  • 2,519
  • 2
  • 16
  • 11

4 Answers4

220

Relevant tmux Commands

  • join-pane -s
  • join-pane -t
  • break-pane

Bindings

You could add the following bindings to your ~/.tmux.conf:

## Join windows: <prefix> s, <prefix> j
bind-key j command-prompt -p "join pane from:"  "join-pane -s '%%'"
bind-key s command-prompt -p "send pane to:"  "join-pane -t '%%'"

The above can move panes between existing windows.

For breaking a pane to a new window, use break-pane (which can also be bound).

Alterative Use

All three commands can be used from the tmux's prompt like: <prefix>+: then break-pane
Or at the shell's prompt (inside tmux) with: tmux break-pane.

demure
  • 6,080
  • 1
  • 27
  • 29
  • 16
    It's worth noting that you target a pane using the following format: "mysession:mywindow.mypane" (if in a different session), and "mywindow.mypane" (if in the same session). You can also use "mysession:progname" if the program running in that pane is unique. – Ben Davis Feb 13 '14 at 00:32
  • 35
    `bind-key !` from the other answer is all I need. – the Nov 10 '14 at 15:22
  • And what is the difference between `join-pane -s` and `join-pane -t`? – Jean Paul Jan 19 '21 at 13:48
  • @JeanPaul well, if the Answer didn't give you context, the tldr; is `-s` == "get the pane from there and bring it here"; while `-t` == "take this current pane and send it there". – demure Jan 20 '21 at 14:34
  • 2
    Thanks. I also found by reading the man that if there are several panes in the window we want to import, we can choose the pane by doing for exampe `join-pane -s 4.0` (a bad habit from computer scientists to always want to start numerotation from 0 but it's another issue). – Jean Paul Jan 20 '21 at 15:36
208

From the commands list, you can see that it's called break-pane and the command is just

bind-key !

where bind-key is defaulted to Ctrl+B

jimbog
  • 2,081
  • 1
  • 11
  • 2
14

In the latest version of tmux, installed from homebrew on OSx - 1.9a - the default key-binding implements join-pane with a menu

bind-key          S choose-window "join-pane -v -s "%%""
bind-key          V choose-window "join-pane -h -s "%%""
Andrew
  • 589
  • 3
  • 6
10

tmux 1.8 or above:

If you are intending to go to a "fullscreen" mode, you can use:

bind-keyz

to "zoom in" (and also zoom-out after you finished your work).

Peyman Karimi
  • 201
  • 2
  • 2
  • Yes, but if from there I want to keep opening new windows and don't want the old context taking up space, I need to break away. – Francesco Oct 23 '20 at 18:48