1

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.

  • 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 Dec 24 '16 at 12:31
  • @MichaelKjörling It's the same "xterm-256color" in both putty configuration as well in the host. Same behavior with xterm. – tcpip Dec 24 '16 at 12:41
  • @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 Dec 24 '16 at 12:42
2

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.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.