How to maximize a pane in tmux?

Quick Answer

To maximize a pane in tmux, press Ctrl+b z. This toggles the current pane between maximized (full window) and its normal size. The same key combination will restore the pane to its original position and size. This "zoom" feature is perfect for temporarily focusing on a specific pane without changing your overall layout.

Ctrl+b z

Detailed Explanation

The pane maximization feature in tmux (often called "zoom") allows you to temporarily expand a pane to fill the entire window, making it easier to focus on a specific task, view more content, or work with complex text editors and applications.

Using the Zoom Feature

To maximize the current pane:

  1. Navigate to the pane you want to maximize
  2. Press Ctrl+b z
  3. The pane will expand to fill the entire window
  4. To restore the pane to its original size, press Ctrl+b z again

When a pane is maximized, you'll notice a "Z" indicator in the status line (if your status line is configured to show it), which helps you remember that you're in a zoomed state.

Command Line Method

You can also maximize a pane using the tmux command prompt:

# Enter command mode with Ctrl+b :, then type:
resize-pane -Z

The -Z flag toggles the zoom state of the pane. This is the same command that Ctrl+b z executes behind the scenes.

Custom Keybindings

If you want to use a different key for maximizing panes, you can set up a custom keybinding in your ~/.tmux.conf file:

# Remap zoom to Ctrl+b m
unbind z
bind m resize-pane -Z

This example changes the zoom keybinding from z to m, which some users find more intuitive (for "maximize").

Showing Zoom Status

To make it more obvious when a pane is zoomed, you can add a zoom indicator to your tmux status line by including #{?window_zoomed_flag,Z,} in your status-right or status-left configuration:

# Add to ~/.tmux.conf to show zoom status in status line
set -g status-right "#{?window_zoomed_flag,[Z],} | %H:%M %d-%b"

This will display a "[Z]" in the status line whenever a pane is zoomed, making it easier to remember that you're in a maximized state.

Use Cases for Maximizing Panes

The maximize feature is particularly useful in these scenarios:

  • Editing code in a complex editor like Vim or Emacs where you need more screen space
  • Viewing logs or output with long lines that wrap awkwardly in smaller panes
  • Running a terminal UI application that works better with more space
  • Temporarily focusing on one task without disturbing your overall window layout
  • Presenting content to others when sharing your screen
  • Reading documentation or man pages that benefit from more vertical space

Pro Tip

Create a key binding to maximize a pane and immediately enter copy mode, which is useful for reviewing large outputs:

# Add to ~/.tmux.conf
bind C-z resize-pane -Z \; copy-mode

With this configuration, pressing Ctrl+b Ctrl+z will maximize the current pane and immediately enter copy mode, allowing you to scroll and search.

Alternative Approaches

Instead of maximizing a single pane, you might want to consider these alternatives:

  • Break Pane: Use Ctrl+b ! to break the current pane into its own window
  • Resize Panes: Use Ctrl+b Alt+arrow keys to resize panes incrementally
  • Layouts: Cycle through predefined layouts with Ctrl+b Space
  • New Window: Start a new window with Ctrl+b c for tasks that need full-screen focus