The following is an excerpt by Ari Sweedler regarding .vimrc tab and indention settings:
- tabstop — How many columns wide is a tab character worth? Does a
\ttake up 4 columns? 2 columns? 8 columns? Changing this value will change how tabs are displayed. Must be greater than 0, as tabs having no width is never desired.
- shiftwidth — Referred to for “levels of indentation”, where a level of indentation is shiftwidth columns of whitespace. That is, the shift-left-right commands, the formatting commands, and the behavior of vim with cindent or autoindent set is determined by this setting. A shift command says “give me one more (or one less) level of indentation”. Formatting commands are more complicated (
:help gqif you’re curious, they basically parse your file and determine how many layers of indentation should be there). So if vim decides that a line needs 3 levels of indentation then it’ll place 3*shiftwidth columns of whitespace.
- expandtab — Unlike the other settings, this one is a Boolean, and quite straightforward. It answers the question: should vim place spaces or tab upon receiving a whitespace command or a
- softtabstop — Referred to for the
backspacekey. How much whitespace should be inserted when the
tabkey is pressed? And how much whitespace should be removed when the
backspacekey is pressed?
If you want more detail, I’d highly recommend you click the source link below. Ari goes into a lot more depth, using plain English and examples, to describe the above settings.
SOURCE: Ari Sweedler via Medium