Shift-Arrow keys working in KiTTY but not PuTTY for nested tmux configuration

For years I have been using a different prefix key for nested instances on tmux. I use \ on my own server, but a for any other servers I connect to and start a nested tmux session.

I have found this trick which uses Shift+Arrow Keys to switch between windows and nested instances, which is much better.

However, it does not work when I am using PuTTY (using Windows) but it does when I use KiTTY. I cannot figure out why it is not working with PuTTY.

Ctrl+v, Arrow Keys returns the same codes in the terminal when using either programs.


EDIT:

Just after starting a bounty I have realized that Ctrl+v, SHIFT+Arrow Keys does actually come up with different codes.

PuTTY:

SHIFT+Left Arrow = ^[OD

SHIFT+Right Arrow = ^[OC

SHIFT+Up Arrow = ^[OA

SHIFT+Down Arrow = ^[OB

KiTTY:

SHIFT+Right Arrow = ^[[1;2D

SHIFT+Right Arrow = ^[[1;2C

SHIFT+Up Arrow = ^[[1;2A

SHIFT+Down Arrow = ^[[1;2B

So how do I change PuTTY so that it sends the same codes with SHIFT+Arrow Keys?


The answer is you can't, since this is a bug in PuTTY. This was discussed some time ago at stack - https://stackoverflow.com/questions/6202310/putty-shift-arrows

I had the similar problem with tmux and PuTTY, and I switched to KiTTY.


I also cannot manage to find any method for remapping keys in PuTTY, so I suggest using a AutoHotkey script.

An example script that maps ShiftRight to the keys Esc[1;2D, but only for windows whose title contains putty.exe, is:

#IfWinActive, putty.exe
+Right::SendInput, {esc}[1;2D
#IfWinActive

Place the script in a file with the suffix .ahk and double-click to test. If it works, you could copy it to the Startup scripts folder so it starts when you logon.