Recently because to play tensorflow, so the dusty ubantu to open, but configure the network time, is a mess, appeared in the insert mode, the input direction key can not move the cursor but become garbled; backspace key can not delete characters, can only move the problem of the cursor. Really be engaged in the "burn". Later found a good article finally solved the problem, here record, right when it is a note.
There are several ways to solve this problem:
First, edit/etc/vim/vimrc.tiny
Since the owner of the/etc/vim/vimrc.tiny is the root user, the file should be modified with root permissions. Very simply, the penultimate sentence in this file is "set compatible", as follows:
Changing the "compatible" to "nocompatible" incompatible mode will solve the problem of the directional keys becoming ABCD. The next to solve the problem of backspace key is also very simple, in that sentence after adding a sentence:
Set backspace=2
The following figure shows:
will be able to solve the problem. This time, no matter for which user, use VI can be very convenient according to our custom to edit the file.
Second, install VIM full version
Because Ubuntu is pre-installed with the tiny version, it will cause us to use the above inconvenience. However, after we install the full version of Vim, all keys to the keyboard are normal under VI.
First of all, to unload the old version of VI, enter the following command:
sudo apt-get remove Vim-common
Then install the full version of Vim, and enter the command:
sudo apt-get install vim
After this installation, we still use the "VI" command to activate the new vim when we edit the file, but it is more convenient to operate than tiny.
Third, add ". VIMRC" File
It's not a clever way. It is in the user's personal directory, editing the. vimrc file (Note that the filename is "." Beginning), add the following two sentences:
Set nocompatible //To work in incompatible mode
set backspace=2
As shown in the following illustration:
After the save exits, the user will be able to avoid the problem of the keyboard direction key and the backspace key invalid by using VI.
The reason why it is not a clever way is because we must add ". vimrc" files to each user in their personal directory, so that all users can use the function of VI, this is a relatively large workload. So it's not recommended, even though I did it myself in the initial way (because there are only 2 users on my system, relatively few).
The above three methods, there is always a suitable for you, choose the best, choose the most suitable for you. Bloggers use the first method to solve the problem. Like the point of praise, do not want to spray.