8

When I SSH in to our server, control + arrow sequences are working fine for me: Ctrl + V then Ctrl + up, down, right, left gives ^[OA, ^[OB, ^[OC, and ^[OD respectively. In tmux, I get ^[[A, ^[[B, ^[[C, and ^[[D.

I'm connecting to Ubuntu via PuTTY, but

  • I have the correct terminal set (putty because ncurses-term is installed). All other key combinations are working in the main shell.

  • I'm using the right character set (UTF-8).

  • I'm definitely getting a 256-colour terminal (I've tried multiple invocations of TERM=... tmux)

  • I've read the tmux FAQs that say to use this config:

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

making my config like so:

    set -g default-terminal "screen-256color"
    set -g terminal-overrides "screen*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@"
    set-window-option -g xterm-keys on

since screen was recommended elsewhere (though I tried putty there, too.

The only thing I've found that worked is running tput rmkx within tmux, but I don't know if that's the correct solution, what other effects it has, if other programs will change this setting, or even how it should be set correctly in .tmux.conf so that I don't have to type it in manually all the time.

2

2 Answers 2

5

This is similar to How to enable Control key combinations for GNU screen on putty?, but addresses a different aspect.

In a quick check, it seems that the problem is a conflict between this line

set-window-option -g xterm-keys on

and this:

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

Dropping the set-window-option makes your configuration work for me.

2
  • I exited all tmux sessions, commented out the xterm-keys option with a #, a created a new tmux session and no change.
    – Walf
    Jun 14, 2016 at 0:50
  • Doing the above and using set -g terminal-overrides "putty*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@" worked. (Answer edit to show that correction was rejected.)
    – Walf
    Jul 20, 2016 at 0:40
3

I now no longer use terminal-overrides nor PuTTY at all. My relevant .tmux.conf is this:

set -g default-terminal "tmux-256color"

I use KiTTY for my terminal emulator, and, where possible, compile a KiTTY-specific terminfo file, otherwise use putty-256color as the terminal type.

1
  • With kitty it is working for me. Thanks.
    – Goosebumps
    Apr 28, 2020 at 9:54

You must log in to answer this question.

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