Configure VI or VIM

Source: Internet
Author: User
Configure VI or VIM-general Linux technology-Linux technology and application information. For more information, see. 1. VI or VIM configuration file path
We found that/usr/share/vim/vimrc and/etc/vim/vimrc point to the same file, that is, vimrc, which is the configuration file of vi and vim. modify this file. This path may be different in different LINUX versions.

2. Configure the color
The color display of Xuan VI and VIM enables high brightness to display some special words, which is useful for programming. Later, I opened the file and found that there was already a line in it. I just commented it out with quotation marks. I just needed to remove the quotation marks before the line where syntax on is located. You can also add one line separately: syntax on, and add a line alias vi = "vim" to edit/etc/profile.

3. Set the mouse
When you use VI to edit text, if you want to modify the position far away from the cursor in the file, you can use the mouse to locate it. By default, the mouse is unavailable. If you want to use the mouse, just start another line and write: set mouse =.

4. Set automatic indent
By default, VI and VIM are not indented. The cursor is positioned at the top of each line. If you want to automatically align them, remove the quotation marks before the line where set autoindent is located, or add another row: set autoindent. This is similar to the configuration color. The result of this setting is to automatically align the new line with the previous line after pressing enter.

5. Set the tab indentation.
If you write a program in python, the line indentation is an extremely important concept. The indentation of the same block must be the same. You may like to add spaces in front of the line to indicate indentation, but you must press the Space key multiple times each time. If you like to press the TAB key to indicate indentation, you may think that the text or program you write is not very nice, by default, the TAB indentation of VI and VIM is relatively large (at least six or seven characters ). Set shiftwidth = 3. You can also choose one of your favorite indentation values, such as 2 or 4.
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.