I have ctrl-tab (i.e. ^[[27;5;9~) assigned to switch tabs in vim. It works directly under xterm, but when I also run tmux this sequence works only occasionally. I suppose it is because tmux captures and does not forward that sequence.

Is this a bug or am I using it wrong? My config:

unbind C-b
set-option -g prefix C-a
bind-key a send-prefix

bind-key C-a last-window

set -g base-index 1
set -s escape-time 0

set -g status-bg red
set -g status-right '#(date)'
setw -g window-status-current-attr underscore

setw -g mode-mouse off
setw -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
bind y run-shell -b "tmux save-buffer - | xclip -i -selection clipboard"

# Experimental below
set -g terminal-overrides 'xterm:colors=256'

It will only work "occasionally" in tmux because tmux tries to match its input to keys which are defined in the terminal description:

  • it reads a sequence of bytes, and
  • checks if it matches a key in the "outer" terminal description, and
  • if so, stores that key, and
  • later sends the equivalent byte-sequence for the "inner" terminal description to the program running inside tmux

The escape sequence ^[[27;5;9~ would be sent by xterm if vim is sending the control sequence to switch xterm's modifyOtherKeys resource. tmux blocks that: it never reaches xterm (verified with a test program that sends that control sequence).

If you are seeing this work "occasionally", that could be due to some timing issue that's slowing things down, making tmux not notice the escape sequence.

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.