Zooming tmux panes

The recently released tmux 1.8 includes a new feature, zoomed panes, that allows temporarily expanding a pane to the full size of the tmux window to see more of its contents.

In the man page for tmux(1), the feature is described as follows, under the details for the resize-pane command:

With -Z, the active pane is toggled between zoomed (occupying the
whole of the window) and unzoomed (its normal position in the
layout).

This command is bound to <prefix> z by default; for most users, this will be Ctrl-a z. The effect can be observed by pressing this key sequence in any window with at least two panes, to toggle the zoomed state for the active pane:

Toggle pane zoom state

Note the Z suffix that appears after the window title in the status bar while the pane is zoomed.

For most users, the new feature should mean that any custom maximize/minimize style bindings they may be using are no longer needed. This works particularly smoothly given that the new release also includes support for reflowing text when panes and windows are resized, something GNU Screen has supported for some time.

Be sure to take a look at some of the other changes in the newest release of tmux. If you’re using a DPKG or RPM based packaging system, you might like to build it from source and install it with checkinstall(8).

15 thoughts on “Zooming tmux panes

  1. Thanks a lot. Didn’t know about this feature in new tmux. I used to use shell script for this, but it wasn’t perfect.

  2. This feature definitely would come in handy when v1.8 gets stable in Gentoo Portage tree, which still only have v1.6 as stable.

    I usually have a situation about URL, as you may know common terminal emulators have a feature to make the URL clickable and bring up the link in browser once clicked, but within tmux and if the URL is split into lines because of the pane width. That would be a problem.

    When I know I will need the URL to be intact, I always use break-pane to move the pane to its own window, then re-join back to the original window if necessary. With this new feature, this would save some time to press the key and type the join command.

    Only question is when v1.8 would become stable, I just have to wait. Thanks for sharing this and the nice and clear screenshots.

  3. small typo I guess?

    “by default; for most users, this will be Ctrl-a z”

    The default tmux prefix is Ctrl-b, so I’d say it would be “Ctrl-b z” for most users!

    • Yeah, I’m aware of the defaults, but almost all people I talk to rebind Ctrl+B to Ctrl+A to match the old GNU Screen bindings. I’m sure there are exceptions though!

      • Ok, I don’t want to start a prefix endless discussion, but I can’t see any good reason to insist on keeping the known to be annoying default ^A prefix from screen.

        With readline, ^A is beginning-of-line, ^B is backward-char

        With the default settings, to go to the beginning-of-line you have to – ^A a inside a screen session – while ^A would be enough inside a tmux session. Now, to go one char backward, you have to – ^B within screen – ^B b within tmux

        Which of these two actions do you do the most? I bet this is the first!

        Now, as a few others, I’v longed solved this problem, by using M-w as the prefix (and M-a and M-q for nested and nested-nested screen-or-tmux session)

        As a bonus, (this is actually why I originally started looking for a new prefix), you may also find these prefixes are easier&quicker to use than either ^A or ^B!

        • Oh yes, very much a preference. I wasn’t trying to recommend this or set it as a standard.

          I personally use Ctrl+B a fair bit more than Ctrl+A, and I use Ctrl+B a lot within Vim, so the choice makes sense for me.

          Don’t worry about starting an “endless discussion”. I’m sure people reading the comments appreciate a bit of debate.

        • On the contrary, many people use ^B very often, in particular emacs users, or any person that uses a program that follows the emacs conventions.

          The main argument in favor of using ^A as a prefix instead of ^B is that you often type many ^B’s in a row to go backward in your editing, while you only press ^A once when you want to go back to the beginning of the line. Actually, you often press Control and then B, and keep both keys pressed until you went back enough.

          In any case, people are free to use whatever is convenient for them, and many use something other than either ^A or ^B. See for instance this link

          • I use the backtick as my prefix. Then I can jump to 1 2 3 4 5 windows with one handed gestures. Since I use bash and emacs , I don’t like any of ^A or ^B taken over as a prefix.

            I also bind prefix = to create a new window, so I can quickly do `= (two hands) to create a new window. It’s comfortable and effortless.

            backtick is only a problem when editing SQL and for that I temporarily rebind the prefix away using F11 and F12 keys

            unbind C-b
            set -g prefix \`
            bind-key -n F11 set -g prefix \`
            bind-key -n F12 set -g prefix C-o
            
  4. Tom agreed I mention my solution for maximizing tmux panes to new windows in order to get feedback from more users.

    It works with 1.6+ so if you’re on a system where tmux 1.8 is not available (yet) you might give it a try.

    The idea is to swap the pane you want to maximize with a pane created in another window. Details and screencast on my own site: http://goo.gl/fjS9B

  5. Pingback: Zooming tmux panes | 0ddn1x: tricks with *nix

  6. Pingback: Tmux ha guanyat! | El blog d'en Marc

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use Markdown if you want.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>