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
5 Answers
Type
sudo apt-get install vim
in your terminal, this will solve your problem
- 20,055
- 57
- 82
- 84
- 649
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.
- 7,582
- 4
- 43
- 74
I had the same problem, remember that after typing test.c you have to press key "i" in order to start typing your code
- 11
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)
- 305
- 1
- 5
- 16
Uninstall "vim".
sudo apt-get remove vim
Then, install "vim".
sudo apt-get install vim
I also experienced the same errors as yours so I just uninstalled & installed "vim". Then, these errors were solved.