The vi text in ubuntu is abnormal.

Source: Internet
Author: User
If the vi text in ubuntu is abnormal, edit some files in Ubuntu, which involves the vi editor. In Ubuntu, when vi is initially used, A problem occurs. when the direction keys are used in editing mode, the cursor is not moved, but [A [B... if the vi text in ubuntu is abnormal, edit some files in Ubuntu, which involves 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, however, if [A [B [C [D and other letters are displayed in the command line and the editing is incorrect, the Backspace key cannot be used at ordinary times, delete can only be used. 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: 1. edit/etc/vim/vimrc. tiny due to/etc/vim/vimrc. the owner of tiny is the root user. Therefore, you must modify the file with the root permission. The penultimate sentence in this file is "set compatible", as shown below: set compatible "vim: set ft = vim "change" compatible "to" nocompatible "to incompatible mode to solve the problem of changing direction keys to ABCD. The next step is to solve the problem of Backspace keys. in the previous sentence, add the following sentence: set backspace = 2 becomes as follows: set nocompatibleset backspace = 2 "vim: set ft = vim "to 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 tiny, this will cause 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 run the following command: sudo apt-get remove vim-common, install vim in full, and run the following command: after sudo apt-get install vim is installed, 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: set nocompatible // set backspace = 2 in incompatible mode: set nocompatibleset backspace = 2 after saving and exiting, in the future, this user 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 !!
Related Article

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.