Home and End keys don't work in putty + vim + xterm

2

I'm using putty to ssh to Ubuntu with TERM=xterm-256color.

Inside vim, the home and end keys are not working properly. "Home" key makes vim enter in "Insert" mode and put a 'w' character. Similarly "End" key makes vim enter in "Insert" mode before putting a 'q' character.

The keys work fine outside vim. Home and End key puts the cursor at the beginning of the line or end of the line.

Also, this does not happen when I log in with TERM=linux set. Home and End keys inside vim function properly then.

tcpip

Posted 2016-12-24T10:43:30.973

Reputation: 51

This type of problem almost invariably comes down to the escape sequences being sent for various special keys. Check to make sure $TERM on the host you are connecting to corresponds to the settings in your PuTTY connection profile. – a CVn – 2016-12-24T12:31:01.303

@MichaelKjörling It's the same "xterm-256color" in both putty configuration as well in the host. Same behavior with xterm. – tcpip – 2016-12-24T12:41:05.807

@MichaelKjörling I also tried editing escape sequences both by editing the terminfo file, compiling and exposing $TERMINFO variable. And also via editing /etc/vim/vimrc file and setting the proper values for both Home and End keys. No luck. – tcpip – 2016-12-24T12:42:29.790

Answers

3

Finally. After hours of scouring the internet I stumbled upon something which I should've done much earlier.

Fixed it by checking "Disable application keypad mode" inside Terminal -> Features in PuTTY configuration. Answering it now for anyone who faces this problem.

tcpip

Posted 2016-12-24T10:43:30.973

Reputation: 51