Context: I have a window split into three panes. The top pane is running a script which shows my mercurial status by occasionally running 'hg xl'. My script knows how many lines are output by the command.

Is there a way I can have this program resize its pane to be exactly the right number of lines for this output?


You can have your script run a tmux command to resize the pane to a chosen y height, eg 30 lines:

tmux resize-pane -t "$TMUX_PANE" -y 30

The environment variable TMUX_PANE will have been set by tmux in the shell running in the pane, or you may already know it (e.g. 0.0 for the first pane).

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.