Recent “unreleased” versions of tmux do automatically recognize those xterm-style key sequences once you have your terminal sending them (no need to change your terminfo entry). The next release version (1.8?) should also have this support. With an appropriate build of tmux1, all you have to do is bind the keys in your tmux configuration:
bind-key C-Tab next-window
bind-key C-S-Tab previous-window
You will still need to type your prefix key before these keys.
(Note: ~/.tmux.conf
is only processed when the server starts. If you make changes to it, you will either need to exit all your sessions and restart the server, or use (e.g.) tmux source ~/.tmux.conf
to have your existing server re-process the file.)
Also, if you want tmux to pass along these (and other) xterm-style key sequences to programs running inside tmux, then you will need to enable the xterm-keys
window option.
set-option -gw xterm-keys on
(If you prefer, you can do this on a per-window basis by using -w
instead of -gw
.)
If you want to be able to use those keys without typing the prefix, then you can use “no prefix” bindings instead:
bind-key -n C-Tab next-window
bind-key -n C-S-Tab previous-window
This will more or less “dedicate” the keys to tmux, though. It will be difficult to type these keys to any program running inside tmux (e.g. you would have to use the tmux command send-keys C-Tab
—as normal, xterm-keys
must be enabled to send these xterm-style key sequences).
The problem with your terminfo entry editing is probably because each line after the one that names the terminal type needs to start with a Tab. Lines that do not start with a tab are the beginning of a new terminal entry. Technically, the NL TAB sequence is basically a line continuation in this file format; each entry is a single logical line.
Also, if you are redefining terminfo entries, be sure to use -x
with infocmp and tic to preserve the user-defined capabilities (some of which are fairly standard).
1 I.e. built from recent code in the tmux Git repository at sf.net (at the clone-able URL git://git.code.sf.net/p/tmux/tmux-code
).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…