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?

up vote 143 down vote accepted

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.

  • 9
    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 0:32
  • 10
    bind-key ! from the other answer is all I need. – guaka Nov 10 '14 at 15:22

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

  • 4
    is there a away to attach back "breaked" pane? – nazikus Jun 29 '14 at 11:27
  • 3
    @nazikus you can use join-pane. If you don't see any bindings for it in bind-key ? (I didn't), you can summon the command prompt with bind-key : and execute join-pane -t <destination pane index>. – Austin Adams Jul 15 '15 at 19:14
  • 4
    Don't forget the colon! It's join-pane -t <optional session name>:<destination pane index> e.g. join-pane -t :0 – Walf Jul 28 '16 at 7:11

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 "%%""

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.