Fix: VIM Fix UP and Down Keys Inserting A B C D Character On Remote SSH Session on a Linux or Unix Systems

The issue with the Up and Down arrow keys inserting “A B C D” characters in a remote SSH session in VIM can be caused by the terminal settings being different on the local and remote systems.

To fix this issue, you can add the following lines to your .vimrc file:

set nocompatible
set t_ku=^[A
set t_kd=^[B
set t_kr=^[C
set t_kl=^[D

This sets the correct escape sequences for the Up, Down, Right, and Left arrow keys in VIM.

You can also try adding the following to your .bashrc file:

stty -ixon

This will disable XON/XOFF flow control which can also cause this issue.

(kumorisushi.com)

Leave a Comment