Ubantu under the use of VI, the direction of the key variable letter output, backspace key can not delete characters solution

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.