"Maximizing" a pane in tmux
Sometimes it would be very useful to maximize a pane in tmux and then restore it to it's previous size.
I've been reading the manual and I can't find a way. What I've come up with is that I could bind a key to resize the pane to "max" width, and another key to restore it to some predefined width.
Of course this has its drawbacks, so I'm wondering if anyone has a better idea.
tmux 1.8 and later
Now natively supported, from the below answer:
Version 1.8 saw the addition of the -Z flag to resize-pane. From the man page:
With -Z, the active pane is toggled between zoomed (occupying the whole of the window) and unzoomed (its normal position in the layout).
older tmux (original answer)
Another option could be to use break-pane
followed by join-pane
. From the man page:
break-pane [-d] [-t target-pane]
(alias: breakp)
Break target-pane off from its containing window to make it the
only pane in a new window. If -d is given, the new window does
not become the current window.
join-pane [-dhv] [-l size | -p percentage] [-s src-pane] [-t dst-pane]
(alias: joinp)
Like split-window, but instead of splitting dst-pane and creating
a new pane, split it and move src-pane into the space. This can
be used to reverse break-pane.
So you could select your pane and do break-pane
and then once your done with the maximised version, you could re-join it with join-pane
- might need some default arguments to put it back in place, or just rearrange afterwards.
Note that join-pane appears to be in tmux 1.3 but not 1.1. (Not sure about 1.2, sorry).
And just to mention that terminator (a GUI (GTK based) terminal multiplexer) can do the zoom thing. (Ctrl-Shift-X is the default keybinding). Of course it doesn't do lots of things that tmux does ...
This is now a native tmux feature.
Version 1.8 saw the addition of the -Z
flag to resize-pane
. From the man page:
With -Z, the active pane is toggled between zoomed (occupying the whole of the window) and unzoomed (its normal position in the layout).
It's bound to tmux-prefix-z by default on my installation (via Homebrew on OS X).
So I know you asked this a while ago ... but I didn't switch from screen until today!
I ran into the same problem, here is how I solved it:
unbind +
bind + new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \; swap-pane -s tmux-zoom.0 \; select-window -t tmux-zoom
unbind -
bind - last-window \; swap-pane -s tmux-zoom.0 \; kill-window -t tmux-zoom
If your workflow is like mine (i.e. you maximize a window, do some work, then immediately unmaximize it) this should work great for you.