"0]" if you type "]" as the first character in a line
":" if you type ":" after a label or case statement
"0#" if you type "#" as the first character in a line
"!^F" if you type CTRL-F (which is not inserted)
"o" if you type a <CR> anywhere or use the "o" command (not in
insert mode!)
"O" if you use the "O" command (not in insert mode!)
"e" if you type the second 'e' for an "else" at the start of a
line
Characters that can precede each key: *i_CTRL-F*
! When a "!" precedes the key, Vim will not insert the key but will
instead reindent the current line. This allows you to define a
command key for reindenting the current line. CTRL-F is the default
key for this. Be careful if you define CTRL-I for this because CTRL-I
is the ASCII code for <Tab>.
* When a "*" precedes the key, Vim will reindent the line before
inserting the key. If 'cinkeys' contains "*<Return>", Vim reindents
the current line before opening a new line.
0 When a zero precedes the key (but appears after "!" or "*") Vim will
reindent the line only if the key is the first character you type in
the line. When used before "=" Vim will only reindent the line if
there is only white space before the word.
When neither "!" nor "*" precedes the key, Vim reindents the line after you
type the key. So ";" sets the indentation of a line which includes the ";".
Special key names:
<> Angle brackets mean spelled-out names of keys. For example: "<Up>",
"<Ins>" (see |key-notation|).
^ Letters preceded by a caret (^) are control characters. For example:
"^F" is CTRL-F.
o Reindent a line when you use the "o" command or when Vim opens a new
line below the current one (e.g., when you type <Enter> in insert
mode).
O Reindent a line when you use the "O" command.
e Reindent a line that starts with "else" when you type the second 'e'.
: Reindent a line when a ':' is typed which is after a label or case
statement. Don't reindent for a ":" in "class::method" for C++. To
Reindent for any ":", use "<:>".
=word Reindent when typing the last character of "word". "word" may
actually be part of another word. Thus "=end" would cause reindenting
when typing the "d" in "endif" or "endwhile". But not when typing
"bend". Also reindent when completion produces a word that starts
with "word". "0=word" reindents when there is only white space before
the word.
=~word Like =word, but ignore case.
If you really want to reindent when you type 'o', 'O', 'e', '0', '<', '>',
"*", ':' or '!', use "<o>", "<O>", "<e>", "<0>", "<<>", "<>>", "<*>", "<:>" or
"<!>", respectively, for those keys.
For an emacs-style indent mode where lines aren't indented every time you
press <Enter> but only if you press <Tab>, I suggest: >
:set cinkeys=0{,0},:,0#,!<Tab>,!^F
You might also want to switch off 'autoindent' then.
Note: If you change the current line's indentation manually, Vim ignores the
cindent settings for that line. This prevents vim from reindenting after you
have changed the 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)
{