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