Select windows in tmux using the numeric keypad I'd like to use the numeric keypad to select windows in tmux. Anybody do this?
If your terminal emulator outputs certain codes for the keypad keys, then these commands (e.g. in your .tmux.conf) will bind Keypad 0–Keypad 9 to work exactly like prefix+0–prefix+9:

bind-key -n KP0 select-window -t :0
bind-key -n KP1 select-window -t :1
bind-key -n KP2 select-window -t :2
bind-key -n KP3 select-window -t :3
bind-key -n KP4 select-window -t :4
bind-key -n KP5 select-window -t :5
bind-key -n KP6 select-window -t :6
bind-key -n KP7 select-window -t :7
bind-key -n KP8 select-window -t :8
bind-key -n KP9 select-window -t :9


The -n means that you do not have to use the prefix key; the key names (KPx) do not seem to be in the documentation, but you can find them in the source in the file key-string.c. They values your terminal must send seem to be hard-coded: see tty-keys.c; TTYKEY_RAW means that terminfo is not used, and there are no other entries for the KEYC_KP* keys without TTYKEY_RAW (where terminfo might be consulted; the problem here is that terminfo support for the numeric keypad seems to be incomplete).

You can check whether your terminal emulator sends special codes for the keys by running this outside tmux:

tput smkx;cat -v;tput rmkx


(use Control+c to end the cat instance)

You should probably see something like this for KP0–KP9:

^[Op^[Oq^[Or^[Os^[Ot^[Ou^[Ov^[Ow^[Ox^[Oy


This works for me by default in iTerm2 (Build 1.0.0.20120724), but in Terminal (Version 2.3 (309); from OS X 10.8.2) I had to enable Allow VT100 application keypad mode for a profile (Terminal menu > Preferences…; Settings tab > select a profile > Advanced tab; check Allow VT100 application keypad mode under Emulation).