How to turn down the timeout between prefix key and command key in tmux?
Solution 1:
Up, Down, Left, and Right (select-pane
bindings; and Control- and Meta- of the same keys for resize-pane
) are “repeatable” bindings by default (made via bind-key -r
). After typing the prefix key and any single repeatable key, you can type any other repeatable key (without having to type the prefix again) within the number of milliseconds specified via the repeat-time
session option (the default is 500ms).
You can examine the current value of repeat-time
with these shell commands:
tmux show-options -g | grep \^repeat-time # global
tmux show-options | grep \^repeat-time # this session
If you want to disable the repeat for the current session, then type your prefix, a colon, and enter this command:
set-option repeat-time 0
Or, you might be able to find a comfortable non-zero value. If you really do have a value of around 2000 (i.e. 2s), then I would guess that it is being set in /etc/tmux.conf
.
If you want to disable repetition (or change the timeout) for all your sessions, then set the global value with this command:
set-option -g repeat-time 0
If you have set a per-session value, you will need to unset it before the global value will take effect in that session (set-option -u repeat-time
). You may like to set the global value via your .tmux.conf
if you prefer to leave it off “permanently”.
If you only have problems with Up, you could rebind it without -r
:
bind-key Up select-pane -U
Solution 2:
You could also turn off repeat for specific keybindings, if you wanted. For example, the default bindings for switching between panes boil down to:
bind-key -r Up select-pane -U
bind-key -r Down select-pane -D
bind-key -r Left select-pane -L
bind-key -r Right select-pane -R
You could recreate these without the -r
flag, like
bind-key Up select-pane -U
bind-key Down select-pane -D
bind-key Left select-pane -L
bind-key Right select-pane -R
Personally, I prefer pane-switching to be non-repeatable. Repeat is nice if you've got a window split up into lots of little panes, but it can lead to key collisions (like you described) with the applications running within those panes (like shell history, vim, etc.), and I usually have no more than 2 panes per window anyway. But to each his own.