I have 3 panes in my tmux window:
--------------------------
| | 2 |
| | |
| 1 |----------|
| | 3 |
| | |
--------------------------
Panes 1 and 2 have vim
. Pane 3 runs a cli I am developing. Sometimes I want to compare panes 1 and 2, so I want to hide pane 3:
--------------------------
| | |
| | |
| 1 | 2 |
| | |
| | |
--------------------------
and then bring back pane 3 again. I don't want to kill pane 3 as I have set up some things there and don't want to go though setting them up again.
- Is there something similar to
PREFIX + z
which can zoom pane 2 but without touching pane 1? Or - Is there a way to hide pane 3 quickly and bring it up back when needed?
Best Answer
Use the
break-pane
andjoin-pane
commands. Refer toman tmux
for details, options and usage.Hide Pane 3:
Select pane
3
and enter Prefix-:break-pane -dP
.tmux
will send pane3
to a window in the background (the-d
flag) and print some information about it in pane 2 (the-P
flag). By default you'll see something like1:2.0
(meaning:session:window.pane
). Hit q to continue working.11With some practice you will be able to drop the
-P
flag since you can predict thesession:window.pane
triplet:session
defaults to the current session andpane
defaults to0
whilewindow
will be the next free window identifier.Get Pane 3 back:
To get pane
3
and the layout back, select pane2
and issue Prefix-:join-pane -vs 1:2.0
tellingtmux
to split pane2
vertically (-v
) and to join the (source) pane (-s
) with identifier1:2.0
. Optionally, you can drop either thesession
or thepane
identifier. Note also that tmux stores a command line history, conveniently accessible with Prefix-:-Up or Prefix-:-ctrl-p.You'll probably need some time to get the hang of it, but once you do, you'll surely be able to come up with custom key bindings that are convenient for you.
This question contains some useful information and tricks that might improve your workflow.