There are in fact four main methods available for indentation, each one
overrides the previous if it is enabled, or non-empty for 'indentexpr':
'autoindent' uses the indent from the previous line.
'smartindent' is like 'autoindent' but also recognizes some C syntax to
increase/reduce the indent where appropriate.
'cindent' Works more cleverly than the other two and is configurable to
different indenting styles.
'indentexpr' The most flexible of all: Evaluates an expression to compute
the indent of a line. When non-empty this method overrides
the other ones. See |indent-expression|.
So the 4 indent types are
I can ... set whatever I need in my vimrc but can I use all of the above indention options in my vimrc?
Indention settings are local to a buffer. Typically when you have
filetype plugin indent on you get the default indent setting for the
'filetype'. If you want to change the indent settings for a file type I would recommend you add your changes to
It is also worth looking through
:h indent.text as some filetypes have special options which can change indention styles/preferences.