Terminal
tmux 沒有正確傳遞 ctrl-shift-arrow 序列
Tmux 沒有正確傳遞 ctrl-shift-arrow 序列。它在 emacs 上不起作用,當我使用 時
sed -n l
,我看到它單獨顯示箭頭鍵的轉義序列而不是完整序列例如, ctrl-shift-right 傳遞為
^[[C
(與右鍵的轉義序列相同),而不是^[OC
(在 tmux 之外)。知道如何解決這個問題嗎?請注意,ctrl-arrow 鍵(不帶 shift)和 shift-arrow(不帶 ctrl)正確傳遞。
我的 .tmux.conf 是:
# Changes prefix from Ctrl-b to Alt-a unbind C-b set -g prefix M-a set-option -g default-terminal "xterm-256color" # choosing windows with Alt-# bind -n M-0 select-window -t 0 bind -n M-1 select-window -t 1 bind -n M-2 select-window -t 2 bind -n M-3 select-window -t 3 bind -n M-4 select-window -t 4 bind -n M-5 select-window -t 5 bind -n M-6 select-window -t 6 bind -n M-7 select-window -t 7 bind -n M-8 select-window -t 8 bind -n M-9 select-window -t 9 setw -g monitor-activity on set -g visual-activity on set-window-option -g window-status-current-bg white set -g mode-mouse on set -g mouse-resize-pane on set -g mouse-select-pane on set -g mouse-select-window on # Toggle mouse on bind m \ set -g mode-mouse on \;\ set -g mouse-resize-pane on \;\ set -g mouse-select-pane on \;\ set -g mouse-select-window on \;\ display 'Mouse: ON' # Toggle mouse off bind M \ set -g mode-mouse off \;\ set -g mouse-resize-pane off \;\ set -g mouse-select-pane off \;\ set -g mouse-select-window off \;\ display 'Mouse: OFF' # disable selecting panes with mouse (because enabling mess with copy-paste) set-option -g mouse-select-pane off # display status bar message for 4 sec set-option -g display-time 4000 # Start windows and panes at 1, not 0 set -g base-index 1 set -g pane-base-index 1 # enable shift-arrow keys set-window-option -g xterm-keys on # start default shell set-option -g default-shell $SHELL # support for escape char for vi set -s escape-time 0
看起來
tmux
正在為您的範例做正確的事情:例如, ctrl-shift-right 傳遞為
^[[C
(與右鍵的轉義序列相同),而不是^[OC
(在 tmux 之外)。因為該序列的通常含義是它與主機發送的游標移動相同。零參數與缺失參數相同,恰好是一。
未辨識終端;
xterm
不這樣做。為control``shift``right-arrow
,xterm
可寄^[[1;6C
。在這種情況下,tmux
吸收發送的轉義序列,因為它不在它知道的已知 xterm 樣式鍵的表中。在tmux
中,該文件xterm-keys.c
包含一個表,並帶有註釋:/* * xterm-style function keys append one of the following values before the last * character: * * 2 Shift * 3 Alt * 4 Shift + Alt * 5 Ctrl * 6 Shift + Ctrl * 7 Alt + Ctrl * 8 Shift + Alt + Ctrl * * Rather than parsing them, just match against a table. * * There are three forms for F1-F4 (\\033O_P and \\033O1;_P and \\033[1;_P). * We accept any but always output the latter (it comes first in the table). */