7

I am using Ubuntu 16.04 LTS. I have a file I open in the terminal with vi abc.txt, and to edit/insert some text into it I press the insert button.

When I press the arrow keys /// it inserts the letters A/C/B/D respectively instead of moving the cursor. Even if I type backspace to delete the inserted letter it doesn't get deleted.

Why is this happening? Why are these letter added instead and why are they not getting deleted when I press backspace?

enter image description here

dessert
  • 40,956
D.H.N
  • 81

1 Answers1

6

That is because of wrong terminal settings. Check your TERM variable and make sure it is set correctly.

Most common to do first is a ...

:set term=builtin_ansi

inside vim and see if that works.

Also have a look at this vim wikia page. It has a 24 different approaches to this problem.

Rinzwind
  • 309,379