Putty has incredibly bad defaults. The main issue crops up when trying to use it to interact with z/VM programs that require lots of function keys.
Getting putty to cooperate with tmux and c3270 and have F1-F24 all work requires many settings to be just right.
I troubleshot this using the following commands:
infocmp -I $TERM
showkey -a
where $TERM was a bunch of different terminfo types.
In putty, if you set the "function keys and keypad" to ESC[n~, Linux, or Xterm R6
, you will never achieve F1-F24 bliss because putty sends the same codes for some of these (usually F11 and F1 overlap).
By examining the codes that were sent when I ran showkey -a
I was able to search various terminfo databases to find one that matched. I focused on the screen family because I want to use tmux, and tmux supposedly wants a screen-derived $TERM.
In short, set these in putty's settings:
Terminal - Keyboard - Xterm 216+
Connection - Data - Terminal-type string: screen.xterm-new
Terminal - Keyboard - Shift/Ctrl/Alt with arrow keys - xterm-style-bitamp
Terminal - Features - Disable application cursor keys mode - checked
Terminal - Features - Disable application keypad mode - checked
There are a bunch of other less important settings that I like to change as well. Some of these, especially the copy and paste settings, I expect most people will prefer to use putty's defaults.
Session - logging - All session output
Session - logging - Log file name: D:\putty-data\putty-&H-&Y&M&D-&T.log
Terminal - Bell - None (bell disabled)
Window - Columns:132, Rows:46 (the perfect size for working in host screens)
Window - Lines of scrollback: 250000
Window - Reset scrollback on keypress - checked
Window - Reset scrollback on display activity - unchecked
Window - Appearance - Font - Lucida Console, 12-point
Window - Appearance - Font - ClearType
Window - Appearance - Gap between text and window edge: 6
Window - Behavior - System menu appears on ALT-Space
Window - Behavior - Full screen on Alt-Enter
Window - Selection - Auto-copy selected text to system clipboard - unchecked
Window - Selection - Mouse paste action: Last selected text
Window - Selection - {Ctrl,Shift} + Ins: System clipboard
Window - Selection - Ctrl + Shift + {C,V}: System clipboard
Window - Colours - [See below]
Connection - Seconds between keepalives: 20
Connection - Enable TCP keepalives - checked
Connection - SSH - Enable compression - checked
Connection - SSH - Auth - Display pre-authentication banner - unchecked
Connection - SSH - X11 - Enable X11 forwarding - checked
Color scheme:
I like to use this theme:
https://github.com/AlexAkulov/putty-color-themes/blob/master/48.%20Vaughn.reg
"Colour0"="220,220,204"
"Colour1"="255,94,125"
"Colour2"="37,35,79"
"Colour3"="37,35,79"
"Colour4"="255,85,85"
"Colour5"="255,255,255"
"Colour6"="37,35,79"
"Colour7"="112,144,128"
"Colour8"="112,80,80"
"Colour9"="220,163,163"
"Colour10"="96,180,138"
"Colour11"="96,180,138"
"Colour12"="223,175,143"
"Colour13"="240,223,175"
"Colour14"="85,85,255"
"Colour15"="85,85,255"
"Colour16"="240,140,195"
"Colour17"="236,147,211"
"Colour18"="140,208,211"
"Colour19"="147,224,227"
"Colour20"="112,144,128"
"Colour21"="255,255,255"