2

Tmux doesn't passes correctly the ctrl-shift-arrow sequences. It doesn't work on emacs, and when I use sed -n l, I see it displays the escape sequence of the arrow key alone instead of the full sequnce

For example, ctrl-shift-right passes as ^[[C (which is the same as the escape sequence of the right key), instead of ^[OC (outside tmux).

Any idea of how to solve this? Note that ctrl-arrow key (without shift) and shift-arrow (without ctrl) pass correctly.

My .tmux.conf is:

# 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
2

It looks like tmux is doing the right thing for your example:

For example, ctrl-shift-right passes as ^[[C (which is the same as the escape sequence of the right key), instead of ^[OC (outside tmux).

because the usual connotation of that sequence is that it is the same as cursor-movement sent from the host. A zero parameter is the same as a missing parameter, which happens to be one.

The terminal was not identified; xterm does not do that. For controlshiftright-arrow, xterm may send ^[[1;6C. In this case, tmux absorbs the escape sequence sent, because it is not in the table of known xterm-style keys that it knows about. In tmux, the file xterm-keys.c contains a table, with the comment:

/*                                                     
 * 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).
 */

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.