43

My ~/.tmux.conf:

set -g prefix C-a
unbind C-b
bind C-a send-prefix

bind-key o split-window -v
bind-key e split-window -h

bind-key w kill-pane

(to make the command keys same as GNOME Teminator)

The situation: after horizontal splitting window into 2 panes, switching to a pane with Ctrl+a Up arrow, I must wait for a while (2-3 seconds) to view shell history commands in this pane. Because if I press the Up again it will switch back to the other pane instead of showing me a shell history command. How can I turn down this?

  • A potentially useful alternative is to use CTRL + B q, this shows the window numbers in tmux. Pressing CTRL + B q <number> will take you to that window, up/down will be available immediately. You must type the number following q quite quickly. There is a timeout controlling this, too. – Spacen Jasset Feb 26 '16 at 10:53
50

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
3

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.

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.