1. edit/etc/Vim/vimrc. Tiny
Because the owner of/etc/Vim/vimrc. Tiny is the root user, you must modify the file with the root permission. The penultimate sentence in this file is "set compatible", as shown below:
Change "compatible" to "nocompatible" to incompatible mode to solve the problem of changing the direction key to ABCD. Next, we need to solve the problem of the backspace key, which is also very simple. In the previous sentence, we will add one more sentence:
[CPP] View plaincopy
- Set backspace = 2
As shown in the following figure:
You can solve the problem. At this time, no matter which user, Vi can easily edit files according to our habits.
Ii. Install Vim full
Because ubuntu is pre-installed with the tiny version, it will cause the above inconvenience in use. However, after the vim full version is installed, all the keys on the keyboard are normal under VI.
First, uninstall the earlier version of VI and enter the following command:
[CPP] View plaincopy
- Sudo apt-Get remove vim-common
Run the following command to install Vim of Full Edition:
[CPP] View plaincopy
- Sudo apt-Get install Vim
After the installation, we still use the "Vi" command to start the newly installed Vim when editing the file, but the operation is more convenient than Tiny.
3. Add the ". vimrc" File
This is not a clever method. In the user's personal directory, edit the. vimrc file (note that the file name starts with ".") and add the following two statements:
[CPP] View plaincopy
- Set nocompatible // works in incompatible Mode
- Set backspace = 2
As shown in:
After saving and exiting, you can use VI to avoid invalid keyboard direction keys and backspace keys.
It is not a clever method because we have to add ". in order to make all users use the VI function normally, this is a relatively large workload. Therefore, it is not recommended, although I initially used this solution (because there are only two users in my system, which is relatively small ).
Using VI is a solution that cannot be used when the direction keys become garbled.