PuTTY – Ctrl + Arrow Keys for Tmux Not Working

puttysshtmux

I'm using PuTTY to ssh into a Debian machine. When I try to use Ctrl + [arrow key] to resize panes in tmux, the active pane just switches as if I was not holding Ctrl. Other Ctrl key shortcuts work fine. When I try the same thing using a different terminal, the shortcut works.

Best Answer

Add the following line to ~/.tmux.conf

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

Source: https://stuff.mit.edu/afs/athena/project/bsd/src/tmux-1.3/FAQ

Ctrl and arrow keys doesn't work in putty! What do I do?

putty inverts the sense of the cursor key mode on ctrl, which is a bit hard for tmux to detect properly. To get ctrl keys right, change the terminfo settings so kUP5 (Ctrl-Up etc) are the adjusted versions, and disable smkx/rmkx so tmux doesn't change the mode. For example with this line in .tmux.conf (assuming you have TERM set to xterm):

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

Note that this will only work in tmux 1.2 and above.

Related Question