You need to modify your terminal so that tmux can recognise control+digit keystrokes correctly.
(source: https://unix.stackexchange.com/questions/96884/using-ctrl0-9-to-cycle-between-windows-using-tmux)
If you are using iTerm2, for example, then:
- go to
Preferences > Profiles > Keys
and click +
- input ctrl+0 as the keyboard shortcut
- select
Send Escape Sequence
from the action drop-down menu
- input
Esc+[27;5;48~
in the characters to send textbox
- click OK, then restart iTerm
Then, finally add to your .tmux.conf
the following:
bind-key C-0 select-pane -t 0
restart tmux (make sure to close all sessions withtmux kill-session
). You should now be able to select pane number 0.
To get the other 9 keys to work, repeat the above 5 steps with the appropriate escape sequences. They can be found in the link provided.
tmux.conf
:set -g base-index 1
orset -g pane-base-index 1
? if yes, your window/pane is 1 based. – Kent Sep 8 '13 at 12:57