4

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'

2 Answers 2

1

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.

0

I have a machine where tmux consistently doesn't pass on Ctrl+Tab and Ctrl+Shift+Tab, even though I have another machine using the same tmux version and config where this doesn't happen.

I haven't got to the bottom of why, but the solution that works for me is to configure tmux to explicitly pass these sequences on to whatever is running inside it:

# Pass on Ctrl+Tab and Ctrl+Shift+Tab
bind-key -n C-Tab send-keys Escape [27\;5\;9~
bind-key -n C-S-Tab send-keys Escape [27\;6\;9~

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .