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
Type
sudo apt-get install vim
in your terminal, this will solve your problem
By default, Ubuntu will install
vim-tiny
, a bare-bones version of vim. When you typevi
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 commandvi
start vim up in non-compatible mode.I had the same problem, remember that after typing test.c you have to press key "i" in order to start typing your code
press the insert key to type/delete.
when you're finished editing, pressing esc will allow you to type commands like :wq (save and quit) or :q! (quit without saving)
Uninstall "vim".
Then, install "vim".
I also experienced the same errors as yours so I just uninstalled & installed "vim". Then, these errors were solved.