Vim's tab settings

Source: Internet
Author: User

Article turned from: http://blog.csdn.net/shell_picker/article/details/6033023

Excerpted from the Vim Handbook:

Options :
1. TabStop: Indicates how many spaces a tab displays, default 8
2. Softtabstop: When editing (such as pressing backspace or TAB) A tab is how many spaces (a bit difficult to understand ...) I'm not quite sure, either.
3. Expandtab/noexpandtab: Tab extension/Do not expand to spaces
4. Shiftwidth: How many spaces are indented per level
5. Smarttab: Determine how many spaces a tab is based on the number of indent spaces elsewhere in the file

Command :
: [Range]retab [new_tabstop]: Apply a new TabStop value, replace all tabs, and if you set the Expandtab, the tab in the file will be replaced with spaces.

Several common uses :

1. Keep tab. Let TabStop leave the default, set Softtabstop and Shiftwidth to 4, and set the Noexpandtab. This will keep the tab in the file, and the new indentation will also use tab.

2. Use all spaces. Set TabStop and Shiftwidth to the same value, such as 4, and set the Expandtab. This new indentation will use a space, you press the TAB key, out of all the blanks. If there is a tab in the file, you can use it again: the Retab command, which expands all tabs into spaces, is perfect.

I usually set this in. VIMRC:

" set Tab Indent Set Smarttab  Set tabstop=4set shiftwidth=4set expandtab

Vim's tab settings

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.