indent by typing <BS>, <Tab>, or <Space> in the indent or
used CTRL-T or CTRL-D.
*cinoptions-values*
The 'cinoptions' option sets how Vim performs indentation. The value after
the option character can be one of these (N is any number):
N indent N spaces
-N indent N spaces to the left
Ns N times 'shiftwidth' spaces
-Ns N times 'shiftwidth' spaces to the left
In the list below,
"N" represents a number of your choice (the number can be negative). When
there is an 's' after the number, Vim multiplies the number by 'shiftwidth':
"1s" is 'shiftwidth', "2s" is two times 'shiftwidth', etc. You can use a
decimal point, too: "-0.5s" is minus half a 'shiftwidth'.
The examples below assume a 'shiftwidth' of 4.
*cino->*
>N Amount added for "normal" indent. Used after a line that should
increase the indent (lines starting with "if", an opening brace,
etc.). (default 'shiftwidth').
cino= cino=>2 cino=>2s >
if (cond) if (cond) if (cond)
{ { {
foo; foo; foo;
} } }
<
*cino-e*
eN Add N to the prevailing indent inside a set of braces if the
opening brace at the End of the line (more precise: is not the
first character in a line). This is useful if you want a
different indent when the "{" is at the start of the line from
when "{" is at the end of the line. (default 0).
cino= cino=e2 cino=e-2 >
if (cond) { if (cond) { if (cond) {
foo; foo; foo;
} } }
else else else
{ { {
bar; bar; bar;
} } }
<
*cino-n*
nN Add N to the prevailing indent for a statement after an "if",
"while", etc., if it is NOT inside a set of braces. This is
useful if you want a different indent when there is no "{"
before the statement from when there is a "{" before it.
(default 0).
cino= cino=n2 cino=n-2 >
if (cond) if (cond) if (cond)
foo; foo; foo;
else else else
{ { {
bar; bar; bar;
} } }
<
*cino-f*
fN Place the first opening brace of a function or other block in
column N. This applies only for an opening brace that is not
inside other braces and is at the start of the line. What comes
after the brace is put relative to this brace. (default 0).
cino= cino=f.5s cino=f1s >
func() func() func()
{ { {
int foo; int foo; int foo;
<
*cino-{*
`{N` Place opening braces N characters from the prevailing indent.
This applies only for opening braces that are inside other
braces. (default 0).
cino= cino={.5s cino={1s >
if (cond) if (cond) if (cond)
{ { {
foo; foo; foo;
<
*cino-}*
`}N` Place closing braces N characters from the matching opening
brace. (default 0).
cino= cino={2,}-0.5s cino=}2 >
if (cond) if (cond) if (cond)
{ { {
foo; foo; foo;
} } }
<
*cino-^*
^N Add N to the prevailing indent inside a set of braces if the
opening brace is in column 0. This can specify a different
indent for whole of a function (some may like to set it to a
negative number). (default 0).
cino= cino=^-2 cino=^-s >
func() func() func()
{ { {
if (cond) if (cond) if (cond)
{ { {
a = b; a = b; a = b;
} } }
} } }
<
*cino-L*
LN Controls placement of jump labels. If N is negative, the label
will be placed at column 1. If N is non-negative, the indent of
the label will be the prevailing indent minus N. (default -1).
cino= cino=L2 cino=Ls >
func() func() func()