Install vim in Ubuntu is relatively simple. Use the following command:
Sudo apt-get install vim
The system will automatically install vim. Now there will be two kinds of editors in the system. One is the built-in nano editor, and the other is the installation of vim, what if we want to use vim as the default editor by default?
After vim is installed, you can modify the default editor command in Ubuntu to specify vim as the default editor:
The code is as follows: |
Copy code |
Sudo update-alternatives -- config editor |
The system may prompt the following:
The code is as follows: |
Copy code |
There are 4 alternatives which provide 'editor '. Selection Alternative ----------------------------------------------- 1/usr/bin/vim. tiny 2/bin/ed * + 3/bin/nano 4/usr/bin/vim. basic Press enter to keep the default [*], or type selection number: |
Select/usr/bin/vim. basic, enter 4, and press enter.