Tmux: resize pane with percent

Created on 26 Apr 2016  路  5Comments  路  Source: tmux/tmux

it is great that one can create new pane using split-window with size specified by percent (-p), however, it seems for resize-pane command, it lacks such way to adjust.

It would be nice to have -p option available to resize command as if I switch tmux from a larger screen to a smaller one, the pane might need also get resized.

my current workaround is to add tmux map that calls tput cols or tput lines to compute height/width and feed into resize. If I write those into a shell script, and call it directly it works. But if it was called through tmux by binding it to a key and then using run-shell, it doesn't show the terminal height/width correctly.

Most helpful comment

Now I am using #{pane_height}. And if I want to resize a pane the same as -p 20, I would need to do:

HEIGHT=$(($(tmux display-message -p '#{pane_height}') / 5))
tmux resize-pane -y $HEIGHT

which seems a little too complex

All 5 comments

Added this to the TODO file.

Oh you should be able to use session_width, client_width, etc formats to get the current width and height.

Now I am using #{pane_height}. And if I want to resize a pane the same as -p 20, I would need to do:

HEIGHT=$(($(tmux display-message -p '#{pane_height}') / 5))
tmux resize-pane -y $HEIGHT

which seems a little too complex

I use Putty to login to a remote Ubuntu server from windows.

If I log out by disconnecting from tmux (ctrl+b+d) and then log back in to the same session before, the pane sizes change somewhat. Then I have to figure out what the previous pane size was. It would be very helpful if I could set the pane sizes to scale proportionately to whatever the full window height and width

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ovid picture Ovid  路  4Comments

samuelsimoes picture samuelsimoes  路  4Comments

mhartington picture mhartington  路  3Comments

alexpearce picture alexpearce  路  5Comments

bk2204 picture bk2204  路  4Comments