12

Is it possible to have the same pane appear in two different windows of a single tmux session?

I typically have a single horizontal split in my main window with vim in the top pane (about 80-90% of the terminal height), and a command line in the bottom pane where I run the program I'm working on. Because the bottom window is so small, I often can't see error output, and using tmux's keyboard shortcuts to scroll back is getting tiresome. I'd like to have my second window attach to the same pane so that if I need to see more of my error output, I can just quickly switch to the second window without needing to deal with scrollback. Is this possible?

(I guess one fallback would be to use something like tee to write stdout to a log file and tail that in my second window. I'm hoping that's not necessary though)

9

I'm afraid this is one of the things you can't do with tmux (I would expect the problems with one pane being displayed in several spaces of different sizes to be the main reason). However, there are several ways you can work around that - all based on binding certain actions to some key combinations. Since a lot depends on the layout you are using, having just a simple layout with two panes you are mentioning is making your life much easier

  1. rotate-window - it will just swap the panes, thus giving you 80%-90% for command output (and the small window for ViM).

  2. break-pane vs. join-pane -v -p <preview_percentage> -t !

  3. pipe-pane with command being unbuffered redirection to a named pipe (i.e. a file system node created with mkfifo) - then use tail -f that named pipe in the other pane.

  4. pipe the output to less, which also has the follow mode that tail has (at least the GNU one).

  5. resize-pane -Z on the smaller panel will zoom it on full terminal. Subsequent un-zoom will keep it active so a little bit trickery is needed to make it work comfortably.

  • BTW - "I would expect the problems with one pane being displayed in several spaces of different sizes to be the main reason" That might be a factor in the complexity of implementing it, but tmux does support the same thing at window level, via grouped sessions unix.stackexchange.com/questions/24274/…. It simply adds padding below to the smaller window. Theoretically pane mirroring could be done the same way. – mahemoff Feb 7 '14 at 11:20
  • Hm... you're right, that could be a way to go about it. – peterph Feb 7 '14 at 19:46
3

By default, you can toggle a pane's "zoom state" by pressing Prefix and z (the default prefix is Ctrl+B).

This will make the current pane (your command line pane, for example) occupy the whole window. Press Prefix and z again to "unzoom" the pane.

1

You can use a script to output your pseudo-session to a file and then tail that file in a second window.

In your working pane.

script -f tailme.out

And in your viewing pane.

tail -f tailme.out

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.