I love using Tmux for my terminal.
I have a tiling window manager (i3) for my 15" notebook.
On the left side I open a web browser. Now I can watch videos, read tutorials, develop React applications, etc.
On the right side of my screen I use tmux with two or three panes. The major pane holds a NeoVim instance. That’s what I’m using as my text editor for coding.
Smaller panes are for terminal sessions.
Sometimes I need more panes, but my screen is too small.
In Tmux, you can break out a pane into a new window. Windows resemble tabs. They don’t clutter your main view, but you can switch between the windows.
Break Out a Pane
To break out a pane, you have to type <prefix> !.
(<prefix> is the Tmux command. The default is <CTRL+B>.)
Merge Windows
But what if you want to merge the window back?
You can use the join-pane command. There is no keyboard shortcut, so you have to enter the Tmux command mode. Then you have to tell Tmux the target window.
<prefix> :: enters Tmux command mode<join-pane -t <target-window-number>: where you want the current window moved into-h/-v: join the window horizontally or vertically
Let’s make that a bit easier and create a custom key binding in your tmux configuration (~/.tmux.conf):
# Prompted join-pane
bind-key j command-prompt -p "join pane from: " "join-pane -h -s '%%'"
Now you can type <prefix> j while you’re in the target window. Enter the number of the window you want to merge.