4

I found several questions about this, but I didn't find a working answer.

I'm using putty (0.63) to login to my ubuntu 14.04 vps.
In tmux I would like to use ctrl-left and ctrl-right to switch tmux windows.

Here are the tmux settings I'm using:

bind -n C-Right next-window
bind -n C-Left previous-window
set-option -g default-terminal "xterm-265color"
set-option -gw xterm-keys on

The terminal type string in putty is set to "xterm-256color"

When I login to the vps without starting tmux I have these keycodes:

left: ^[[D
right: ^[[C
ctrl-left: ^[OD
ctrl-right: ^[OC

After starting tmux ctrl-left has the same code as left and ctrl-right has the same code as right.

I tried different settings in putty, but I always get the same codes.

Do I need to make changes in terminfo/inputrc/...? How do I do that?

Can I solve this with "set -g terminal-overrides" in tmux ? Where can I find a list of codes or a detailed explanation?

Any idea how to get this working?

1 Answer 1

2

It seems I just had to add this to .tmux.conf:

set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@"

I tried that before, but there already was a different "set -g terminal-overrides" in the config with other settings. After removing that everything worked.

I found the solution here: https://bbs.archlinux.org/viewtopic.php?id=129912

Update: Here my complete tmux config after some more changes:

bind -n C-Right next-window
bind -n C-Left previous-window
set-option -g default-terminal "screen"
set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E[%p1%d q:Csr=\E[2 q,screen*:XT,*256col*:colors=256"
set-option -gw xterm-keys on
set-option -g assume-paste-time 1
set-option -g base-index 0
set-option -g bell-action any
set-option -g bell-on-alert off
set-option -g default-command ""
set-option -g default-path ""
set-option -g default-shell "/bin/bash"
set-option -g destroy-unattached off
set-option -g detach-on-destroy on
set-option -g display-panes-active-colour red
set-option -g display-panes-colour blue
set-option -g display-panes-time 1000
set-option -g display-time 750
set-option -g history-limit 2000
set-option -g lock-after-time 0
set-option -g lock-command "lock -np"
set-option -g lock-server on
set-option -g message-attr none
set-option -g message-bg colour16
set-option -g message-command-attr none
set-option -g message-command-bg colour16
set-option -g message-command-fg colour253
set-option -g message-fg colour253
set-option -g message-limit 20
set-option -g mouse-resize-pane off
set-option -g mouse-select-pane off
set-option -g mouse-select-window off
set-option -g mouse-utf8 on
set-option -g pane-active-border-bg default
set-option -g pane-active-border-fg colour144
set-option -g pane-border-bg default
set-option -g pane-border-fg colour16
set-option -g prefix C-b
set-option -g renumber-windows off
set-option -g repeat-time 500
set-option -g set-remain-on-exit off
set-option -g set-titles off
set-option -g set-titles-string "#S:#I:#W - "#T""
set-option -g status on
set-option -g status-attr none
set-option -g status-bg colour67
set-option -g status-fg black
set-option -g status-interval 15
set-option -g status-justify left
set-option -g status-keys emacs
set-option -g status-left "#[fg=colour232,bg=colour144] #S #[fg=colour144,bg=colour67,nobold,nounderscore,noitalics]"
set-option -g status-left-attr none
set-option -g status-left-bg default
set-option -g status-left-fg default
set-option -g status-left-length 100
set-option -g status-position bottom
set-option -g status-right "#[fg=colour16,bg=colour67,nobold,nounderscore,noitalics]#[fg=colour253,bg=colour16] %Y-%m-%d  %H:%M #[fg=colour144,bg=colour16,nobold,nounderscore,noitalics]#[fg=colour232,bg=colour144] #h "
set-option -g status-right-attr none
set-option -g status-right-bg default
set-option -g status-right-fg default
set-option -g status-right-length 100
set-option -g status-utf8 on
set-option -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-content off
set-option -g visual-silence off
set-option -g word-separators " -_@"

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.