[cfe-commits] r172004 - in /cfe/trunk/docs: ClangCheck.rst ClangFormat.rst ClangTools.rst LibFormat.rst index.rst

Sean Silva silvas at purdue.edu
Wed Jan 9 14:26:34 PST 2013


On Wed, Jan 9, 2013 at 5:23 PM, Daniel Jasper <djasper at google.com> wrote:
> It is so tempting to use C-F in insert mode, where it does not seem to be
> used

CTRL-F in insert mode is "already used for formatting". I've never
heard of it being used though, so it might be viable.

:help i_CTRL-F

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.


-- Sean Silva



More information about the cfe-commits mailing list