VIM - Config - Indentation - Indentation with mixed tabs and spaces
To indent with mixed tabs and spaces.
set shiftwidth=2
set softtabstop=2
NOTE: These settings will result in a mix of tabs and spaces being used for indentation.
The principle is to set set shiftwidth and set softtabstop to the same value, leave expandtab at its default (noexpandtab).
Usually, tabstop is left at its default value as well.
shiftwidth affects what happens when you press », « or ==.
It also affects how automatic indentation works.
softtabstop affects what happens when you press the <TAB> or <BS> keys.
Its default value is the same as the value of tabstop, but when using indentation without hard tabs or mixed indentation, you want to set it to the same value as shiftwidth.
If expandtab is unset, and tabstop is different from softtabstop, the <TAB> key will minimize the amount of spaces inserted by using multiples of TAB characters.
For instance, if tabstop is 8, and the amount of consecutive space inserted is 20, two TAB characters and four spaces will be used.