How to edit a file in vi editor (arrow keys prints letters)? [duplicate]

Solution 1:

If you don't already have a .vimrc file in your home directory, create one using this:

vim ~/.vimrc

Add this line to the top of the file:

set nocompatible

Save the file and this should fix the problem for you. :)

Solution 2:

Installing the vim package will fix the problem:

sudo apt-get install vim

There are many good vim/vi tutorials on YouTube, or the web generally. For your problem, see the article 8 Essential Vim Editor Navigation Fundamentals.

Then continue to open files as usual:

vi desired-file