Skip to content
shellhacks.dev
Tooling

Zoom a pane to full screen

Zoom one pane to fill the window with resize-pane -Z, or prefix then z, and call it again to restore. The window shows a Z flag while zoomed.

1 min read
Summarize in AI

A long log in a small pane needs the whole screen for a moment, without rearranging the layout.

Shell
tmux kill-server 2>/dev/null; sleep 1
tmux new-session -d -s w -x 120 -y 30
tmux split-window -h -t w
tmux select-pane -t w:0.0
echo "normal: $(tmux display -p -t w:0.0 '#{pane_width}x#{pane_height} flags=#{window_flags}')"
tmux resize-pane -Z -t w:0.0
echo "zoomed: $(tmux display -p -t w:0.0 '#{pane_width}x#{pane_height} flags=#{window_flags}')"
tmux resize-pane -Z -t w:0.0
echo "again:  $(tmux display -p -t w:0.0 '#{pane_width}x#{pane_height} flags=#{window_flags}')"
tmux kill-server
Text
normal: 60x30 flags=*
zoomed: 120x30 flags=*Z
again:  60x30 flags=*

resize-pane -Z toggles the zoom state of a pane. The pane takes the whole window while the other panes are hidden but keep running and keep their sizes, and the window flags gain a Z, which shows in the status line. The same command restores the layout, so nothing was rearranged. It is in the tmux manual and has been available since tmux 1.8.

Commands that act on another pane, such as select-pane or a split, will unzoom the window first unless you pass -Z to keep it. The state belongs to the window, so only one pane can be zoomed at a time. Copy mode works in a zoomed pane as usual.

Share

More snippets

Tooling

Swap two panes in a window

Swap two panes in a window with swap-pane -s source -t target. The panes keep their IDs and running programs and trade positions, and prefix then braces do it.

2 min read
Tooling

Split a pane

Split a tmux pane with split-window -h for side by side and -v for stacked. The key bindings are prefix then percent and prefix then a double quote.

1 min read
Tooling

Resize a pane

Resize a pane with resize-pane -x 30 for an exact width or -R 10 to move its edge. The keys are prefix then Ctrl and an arrow, one cell at a time.

1 min read

Get new posts by email

One email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.