Set the tab key in vim

Source: Internet
Author: User
In vim, when the tab key is set today, we accidentally realized that the tab key in vim is left with eight spaces, which is a waste of space. Baidu found that all the personalized settings of vim are controlled by a file named. vimrc. you can configure the file. vimrc to tell vim how to personalize services for us .... In vim, when the tab key is set today, we accidentally realized that the tab key in vim is left with eight spaces, which is a waste of space. Baidu found that all the personalized settings of vim are controlled by a file named. vimrc, that is, by configuring the file. vimrc, we can tell vim how to personalize services for us. The first question is, where is the. vimrc file? Locate finds that this file does not exist locally. Baidu finds that this file should generally be placed in the user's root directory. So: echo $ HOME. because I used root to log on, $ HOME =/root. Therefore, you touch the file. vimrc under/root, and the next task is to configure. vimrc. The second question is how to configure it? In general, the tab key is equivalent to four spaces. We only need to add the following two lines to. vimrc: set ts = 4 set expandtab and restart vim. the experiment shows that the tab has four spaces. The configuration file vimrc is used for the first time to optimize some vim settings and find the path. other similar requirements can be found along this path.
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.