PuTTY: Wrong function key codes sent to server
Tagged:  •  

For a little while I use xdebug and vim in order to debug PHP code (see the vim-debugger module). With the F2, F3 and F4 keys you can step through the code. However, all of a sudden the functions keys did not do what I expected. With every function key I pressed vim complained with:

E21: Cannot make changes, 'modifiable' is off

The cause was that I was running vim inside PuTTY, which sends the wrong key codes to the server. The default keyboard setting is ESC[n~. But, in order to send the function keys properly to the server, this setting needs to be set to Xterm R6.