How to set the TAB key in vim for easier operation

Source: Internet
Author: User

In Vim can set a number of personality keys, where the TAB key is one of them, but the use of the TAB key in Vim is very troublesome, is back 8 spaces, feel more wasted space. Then how to set up will be more simple! Now go and see it together!

Baidu found that all of Vim's personalization settings are controlled by a file called. VIMRC, which can be configured by configuring the. vimrc file to tell vim how to personalize the service for us.

The first question is, where is the. vimrc file? Locate found that there is no local file, Baidu found that this file should generally be placed in the user's root directory.

So: Echo $HOME, because I landed with Root, so $home=/root.

So I touch the file under/root. VIMRC, the next job is to configure the. VIMRC.

The second question is how to configure it? In general, the TAB key is equivalent to a 4 blank space. We only need to add the following two lines in the. VIMRC:

Set ts = 4

Set Expandtab

Restart Vim, the Experiment found tab has returned 4 spaces.

For the first time. VIMRC This configuration file to optimize some of the Vim's settings, find the way, and other similar requirements along this path should be possible.

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.