Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to set tmux so that it automatically adjusts window width when I switch to the pane so that it will be wide axactly as the longest (visible on screen) line in the file I have open?

I'm doing this manually with the command

:resize-pane -R 10
:resize-pane -L 10

I always have to guess the number and when I switch to another pane I have to do it again

Note that this functionality is relevant only to vertical panes.

share|improve this question

There does not seem to be a way to do this automatically. You can, however use the mouse:

 mouse-resize-pane [on | off] 
    If on, tmux captures the mouse and allows panes to be
    resized by dragging on their borders.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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