Using vi in ubuntu is a solution for changing the direction keys to garbled characters _ The backspace key cannot be used.

Source: Internet
Author: User
Using vi in ubuntu is a solution for changing the direction keys to garbled characters _ The backspace key cannot be used. This evening, the teacher assigned us a ubuntu Virtual Machine and said we would like to use it for experiments. Of course, it doesn't matter. My favorite is ubuntu, but it may be a very difficult experiment process for some people who are not familiar with linux. Using vi in ubuntu is a solution for changing the direction keys to garbled characters _ The backspace key cannot be used. This evening, the teacher assigned us a ubuntu Virtual Machine and said we would like to use it for experiments. Of course, it doesn't matter. My favorite is ubuntu, but it may be a very difficult experiment process for some people who are not familiar with linux.
The teacher asked us to edit some files in ubuntu, which involved the vi editor. In ubuntu, when vi is initially used, it is a problem that when the direction key is used in editing mode, it does not move the cursor, CommandIf [A [B [C [D and other letters are displayed in the row and an editing error occurs, the Backspace key cannot be used at ordinary times and can only be deleted using Delete. There are many answers to this question on the Internet, such as installing the full version of vim and editing/etc/vim/vimrc. tiny and other methods are messy. Here I will make a detailed summary: www.2cto.com
1. edit/etc/vim/vimrc. tiny because the owner of/etc/vim/vimrc. tiny is a 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 Backspace keys. In the previous sentence, we will add the following sentence: [cpp] 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. Www.2cto.com II. Install vim full version Because ubuntu is pre-installed with 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] sudo apt-get remove vim-common and install vim in full. Run the following command: [cpp] 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. Adding a ". vimrc" file is not a clever method. It is edited in the user's personal directory. vimrc file (note that the file name is ". "), add the following two statements: [cpp] set nocompatible // set backspace = 2 in incompatible mode, as shown in: www.2cto.com
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 ). There is always one of the above three methods that suits you. It's better to select the best one !!

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.