Quantcast
Channel: User Kamil Maciorowski - Super User
Viewing all articles
Browse latest Browse all 670

Answer by Kamil Maciorowski for How do I resize tmux pane by holding down prefix and arrow key for a while?

$
0
0

By default these bindings (among others) are active:

bind-key -r -T prefix       M-Up              resize-pane -U 5bind-key -r -T prefix       M-Down            resize-pane -D 5bind-key -r -T prefix       M-Left            resize-pane -L 5bind-key -r -T prefix       M-Right           resize-pane -R 5bind-key -r -T prefix       C-Up              resize-pane -Ubind-key -r -T prefix       C-Down            resize-pane -Dbind-key -r -T prefix       C-Left            resize-pane -Lbind-key -r -T prefix       C-Right           resize-pane -R

This means you can resize a pane by prefixAlt or prefixCtrl etc.

(The default prefix is Ctrl B.)

Thanks to -r you can do prefixCtrl without repeating prefix many times, if you strike fast enough. Holding instead of striking it repeatedly may or may not work. If it doesn't work then it means tmux does not receive the second (or later) soon enough. In this case you can:

  • Reconfigure your keyboard. E.g. in my Kubuntu the initial delay is 600 ms, which is higher than the default threshold of 500 ms used by tmux, therefore holding doesn't work by default. Then there will be 25 repeats per second, i.e. with the average interval of 40 ms, which is good enough for tmux. Changing 600 ms to 400 ms in the system-wide keyboard settings allows me to use prefixCtrl (hold).

  • Reconfigure tmux. The behavior is governed by the repeat-time option:

    repeat-time time
    Allow multiple commands to be entered without pressing the prefix-key again in the specified time milliseconds (the default is 500). Whether a key repeats may be set when it is bound using the -r flag to bind-key. Repeat is enabled for the default keys bound to the resize-pane command.

    Example command (in a shell inside tmux):

    tmux set repeat-time 1000

    Or in ~/.tmux.conf (permanent setting):

    set -g repeat-time 1000

Whichever method you choose (one or both), you want repeat-time in tmux to be higher than the delay and the repeat interval in your keyboard settings. Then you will even be able to

prefixCtrl (hold)(hold)(hold)(hold)

with just one prefix and without releasing Ctrl, if only you switch between , , and fast enough. If your prefix includes Ctrl then you don't need to release it. I mean with the default prefix of Ctrl B you can do this:

Ctrl B(hold)(hold)(hold)(hold)

holding Ctrl during the entire sequence.


Viewing all articles
Browse latest Browse all 670

Trending Articles