brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: tmux resize-pane -x 80 gives a pane an exact width

Tmux
~/tips/tip-tmux-resize-pane-exact

tmux resize-pane -x 80

Sets a pane to a precise number of columns or a percentage.

Nudging a border with the arrow keys is fine for small changes. When I know the size I want, I’d rather type it.

tmux resize-pane -x 80

That makes the current pane exactly 80 columns wide, which is handy for an editor next to a shell. -y does the same for height, and both accept a percentage of the window:

tmux resize-pane -t 1 -y 30%

-t 1 picks pane 1 of the current window, so you can size a pane without moving into it first. From inside tmux you type the same thing after Ctrl-b :, without the word tmux.

I find percentages the nicer choice in a config or a startup script, because they still make sense when you attach from a smaller laptop screen. A bind for a fixed editor width could look like this:

bind W resize-pane -x 100

Sizes are a request, not a promise. If the window is too small, or the other panes would end up with less than one line, tmux gives you what fits. And as soon as you pick another layout, your exact numbers are thrown away.

Further reading: tmux manual page (OpenBSD)

More Tmux tips tmux new -d -s report -x 200 -y 50 'top' tmux wait-for build-done set -g allow-passthrough on tmux kill-server Ctrl-b [ All Tmux tips (125) All topics

Link