Cygwin Terminal backspace and arrow keys not working

Solution 1:

The best answer I have found so far is to copy Cygwin VIM's sample vimrc file:

cp /usr/share/vim/vim*/vimrc_example.vim ~/.vimrc

Solves all of the weird keymap issues I was seeing plus adds some extras like syntax highlighting.

Source

Solution 2:

Here is simple solution for this.

This is about vim and remote shell, but it should work.

Fix arrow keys that display A B C D on remote shell

It says:

1) Open Vim editor,
2) Get the path of your home directory by typing :echo $HOME
3) Check if you have .vimrc file in $HOME location,(if you don't have create it)
4) Add the following line line to .vimrc file
   set nocompatible
        or
   set nocp

If you have vi (not vim) - configuration file is .virc not .vimrc.

Solution 3:

I did like this and it has fixed the problem . Open vi editor from $home using :

vi -N .bashrc

then scroll down to the bottom or start a new line, Now in Insert Mode type

alias vim='vi -N'

Now as usual save the file. Type

:wq 

It will fix the issue..

Solution 4:

I'd like to add that the solution offered by Kamil fixes the arrow key problem.

However, the backspace problem remained. The solution found here is to add the line

set backspace=2

to ~/.vimrc