tmux 未正确传递 ctrl-shift-arrow 序列

tmux 未正确传递 ctrl-shift-arrow 序列

Tmux 无法正确传递 ctrl-shift-arrow 序列。它在 emacs 上不起作用,当我使用 时sed -n l,我看到它单独显示箭头键的转义序列而不是完整的序列

例如,ctrl-shift-right 传递为^[[C(与右键的转义序列相同),而不是^[OC(在 tmux 之外)。

知道如何解决这个问题吗?请注意,ctrl-箭头键(不带shift)和shift-箭头(不带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

答案1

看起来tmux对于您的示例来说是正确的事情:

例如,ctrl-shift-right 传递为^[[C(与右键的转义序列相同),而不是^[OC(在 tmux 之外)。

因为该序列的通常含义是它与从主机发送的光标移动相同。 A参数与缺失参数相同,恰好是

终端未被识别;xterm不这样做。对于controlshiftright-arrowxterm可以发送^[[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).
 */

相关内容