ubuntu terminal is not working properly in vi editor

Recently I installed ubuntu in my laptop for using c programming. but when I open the terminal and typed vi test.c, It open it but it will not work properly. when i pressed backspace it will not work and when i press arrow key it will print some alphabets. What will i do to work properly. please anybody help for this related problem. thank you


Solution 1:

Type sudo apt-get install vim

in your terminal, this will solve your problem

Solution 2:

By default, Ubuntu will install vim-tiny, a bare-bones version of vim. When you type vi in the terminal, it will start this minimal vim in vi compatible mode by default. From a normal vim user's standpoint, this is horrible, since vi compatible means backspace and all the normal vim behavior will behave in the original vi manner.

One solution is to open up .vimrc and turn off vim compatible mode by including the line: set nocompatible.

The other is to manually install more feature-filled version of vim (like the full version), e.g. sudo apt-get install vim. By default, on Debian-based systems like Ubuntu, this will make the command vi start vim up in non-compatible mode.

Solution 3:

I had the same problem, remember that after typing test.c you have to press key "i" in order to start typing your code