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.