annotate runtime/doc/indent.txt @ 2217:120502692d82 vim73

Improve the MS-Windows installer.
author Bram Moolenaar <bram@vim.org>
date Mon, 24 May 2010 21:34:22 +0200
parents 7c8c7c95a865
children 733f0dc510c3 0b3be97064e5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2154
7c8c7c95a865 First step in the Vim 7.3 branch. Changed version numbers.
Bram Moolenaar <bram@zimbu.org>
parents: 2152
diff changeset
1 *indent.txt* For Vim version 7.3a. Last change: 2010 Mar 27
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 VIM REFERENCE MANUAL by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 This file is about indenting C programs and other files.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
9 1. Indenting C style programs |C-indenting|
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 2. Indenting by expression |indent-expression|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 ==============================================================================
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
13 1. Indenting C style programs *C-indenting*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
15 The basics for C style indenting are explained in section |30.2| of the user
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
16 manual.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
18 Vim has options for automatically indenting C style program files. Many
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
19 programming languages including Java and C++ follow very closely the
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
20 formatting conventions established with C. These options affect only the
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
21 indent and do not perform other formatting. There are additional options that
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
22 affect other kinds of formatting as well as indenting, see |format-comments|,
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
23 |fo-table|, |gq| and |formatting| for the main ones.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 Note that this will not work when the |+smartindent| or |+cindent| features
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 have been disabled at compile time.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
28 There are in fact four main methods available for indentation, each one
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
29 overrides the previous if it is enabled, or non-empty for 'indentexpr':
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 'autoindent' uses the indent from the previous line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 'smartindent' is like 'autoindent' but also recognizes some C syntax to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 increase/reduce the indent where appropriate.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 'cindent' Works more cleverly than the other two and is configurable to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 different indenting styles.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 'indentexpr' The most flexible of all: Evaluates an expression to compute
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 the indent of a line. When non-empty this method overrides
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 the other ones. See |indent-expression|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 The rest of this section describes the 'cindent' option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 Note that 'cindent' indenting does not work for every code scenario. Vim
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
41 is not a C compiler: it does not recognize all syntax. One requirement is
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
42 that toplevel functions have a '{' in the first column. Otherwise they are
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
43 easily confused with declarations.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 These four options control C program indenting:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 'cindent' Enables Vim to perform C program indenting automatically.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 'cinkeys' Specifies which keys trigger reindenting in insert mode.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 'cinoptions' Sets your preferred indent style.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 'cinwords' Defines keywords that start an extra indent in the next line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 If 'lisp' is not on and 'equalprg' is empty, the "=" operator indents using
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 Vim's built-in algorithm rather than calling an external program.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 See |autocommand| for how to set the 'cindent' option automatically for C code
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 files and reset it for others.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 *cinkeys-format* *indentkeys-format*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 The 'cinkeys' option is a string that controls Vim's indenting in response to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 typing certain characters or commands in certain contexts. Note that this not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 only triggers C-indenting. When 'indentexpr' is not empty 'indentkeys' is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 used instead. The format of 'cinkeys' and 'indentkeys' is equal.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 The default is "0{,0},0),:,0#,!^F,o,O,e" which specifies that indenting occurs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 as follows:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 "0{" if you type '{' as the first character in a line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 "0}" if you type '}' as the first character in a line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 "0)" if you type ')' as the first character in a line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 ":" if you type ':' after a label or case statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 "0#" if you type '#' as the first character in a line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 "!^F" if you type CTRL-F (which is not inserted)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 "o" if you type a <CR> anywhere or use the "o" command (not in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 insert mode!)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 "O" if you use the "O" command (not in insert mode!)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 "e" if you type the second 'e' for an "else" at the start of a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
818
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 810
diff changeset
78 Characters that can precede each key: *i_CTRL-F*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 ! When a '!' precedes the key, Vim will not insert the key but will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 instead reindent the current line. This allows you to define a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 command key for reindenting the current line. CTRL-F is the default
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 key for this. Be careful if you define CTRL-I for this because CTRL-I
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 is the ASCII code for <Tab>.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 * When a '*' precedes the key, Vim will reindent the line before
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 inserting the key. If 'cinkeys' contains "*<Return>", Vim reindents
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 the current line before opening a new line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 0 When a zero precedes the key (but appears after '!' or '*') Vim will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 reindent the line only if the key is the first character you type in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 the line. When used before "=" Vim will only reindent the line if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 there is only white space before the word.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 When neither '!' nor '*' precedes the key, Vim reindents the line after you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 type the key. So ';' sets the indentation of a line which includes the ';'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 Special key names:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 <> Angle brackets mean spelled-out names of keys. For example: "<Up>",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 "<Ins>" (see |key-notation|).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 ^ Letters preceded by a caret (^) are control characters. For example:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 "^F" is CTRL-F.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 o Reindent a line when you use the "o" command or when Vim opens a new
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 line below the current one (e.g., when you type <Enter> in insert
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 mode).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 O Reindent a line when you use the "O" command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 e Reindent a line that starts with "else" when you type the second 'e'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 : Reindent a line when a ':' is typed which is after a label or case
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 statement. Don't reindent for a ":" in "class::method" for C++. To
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 Reindent for any ":", use "<:>".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 =word Reindent when typing the last character of "word". "word" may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 actually be part of another word. Thus "=end" would cause reindenting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 when typing the "d" in "endif" or "endwhile". But not when typing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 "bend". Also reindent when completion produces a word that starts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 with "word". "0=word" reindents when there is only white space before
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 the word.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 =~word Like =word, but ignore case.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 If you really want to reindent when you type 'o', 'O', 'e', '0', '<', '>',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 '*', ':' or '!', use "<o>", "<O>", "<e>", "<0>", "<<>", "<>>", "<*>", "<:>" or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 "<!>", respectively, for those keys.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 For an emacs-style indent mode where lines aren't indented every time you
1247
ac4972c657bd updated for version 7.1
vimboss
parents: 1201
diff changeset
121 press <Enter> but only if you press <Tab>, I suggest:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 :set cinkeys=0{,0},:,0#,!<Tab>,!^F
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 You might also want to switch off 'autoindent' then.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 Note: If you change the current line's indentation manually, Vim ignores the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 cindent settings for that line. This prevents vim from reindenting after you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 have changed the indent by typing <BS>, <Tab>, or <Space> in the indent or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 used CTRL-T or CTRL-D.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 *cinoptions-values*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 The 'cinoptions' option sets how Vim performs indentation. In the list below,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 "N" represents a number of your choice (the number can be negative). When
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 there is an 's' after the number, Vim multiplies the number by 'shiftwidth':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 "1s" is 'shiftwidth', "2s" is two times 'shiftwidth', etc. You can use a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 decimal point, too: "-0.5s" is minus half a 'shiftwidth'. The examples below
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 assume a 'shiftwidth' of 4.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 >N Amount added for "normal" indent. Used after a line that should
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 increase the indent (lines starting with "if", an opening brace,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 etc.). (default 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 cino= cino=>2 cino=>2s >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 if (cond) if (cond) if (cond)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 foo; foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 eN Add N to the prevailing indent inside a set of braces if the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 opening brace at the End of the line (more precise: is not the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 first character in a line). This is useful if you want a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 different indent when the '{' is at the start of the line from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 when '{' is at the end of the line. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 cino= cino=e2 cino=e-2 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 if (cond) { if (cond) { if (cond) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 foo; foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 else else else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 bar; bar; bar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 nN Add N to the prevailing indent for a statement after an "if",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 "while", etc., if it is NOT inside a set of braces. This is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 useful if you want a different indent when there is no '{'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 before the statement from when there is a '{' before it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 cino= cino=n2 cino=n-2 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 if (cond) if (cond) if (cond)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 foo; foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 else else else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 bar; bar; bar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 fN Place the first opening brace of a function or other block in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 column N. This applies only for an opening brace that is not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 inside other braces and is at the start of the line. What comes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 after the brace is put relative to this brace. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 cino= cino=f.5s cino=f1s >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 func() func() func()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 int foo; int foo; int foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 {N Place opening braces N characters from the prevailing indent.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 This applies only for opening braces that are inside other
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 braces. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 cino= cino={.5s cino={1s >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 if (cond) if (cond) if (cond)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 foo; foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 }N Place closing braces N characters from the matching opening
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 brace. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 cino= cino={2,}-0.5s cino=}2 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 if (cond) if (cond) if (cond)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 foo; foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 ^N Add N to the prevailing indent inside a set of braces if the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 opening brace is in column 0. This can specify a different
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 indent for whole of a function (some may like to set it to a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 negative number). (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 cino= cino=^-2 cino=^-s >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 func() func() func()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 if (cond) if (cond) if (cond)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 a = b; a = b; a = b;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 :N Place case labels N characters from the indent of the switch().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 (default 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 cino= cino=:0 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 switch (x) switch(x)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 case 1: case 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 a = b; a = b;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 default: default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 =N Place statements occurring after a case label N characters from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 the indent of the label. (default 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 cino= cino==10 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 case 11: case 11: a = a + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 a = a + 1; b = b + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 lN If N != 0 Vim will align with a case label instead of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 statement after it in the same line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 cino= cino=l1 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 switch (a) { switch (a) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 case 1: { case 1: {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 break; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 bN If N != 0 Vim will align a final "break" with the case label,
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
247 so that case..break looks like a sort of block. (default: 0).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 cino= cino=b1 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 switch (x) switch(x)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 case 1: case 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 a = b; a = b;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 break; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 default: default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 a = 0; a = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 break; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 gN Place C++ scope declarations N characters from the indent of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 block they are in. (default 'shiftwidth'). A scope declaration
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 can be "public:", "protected:" or "private:".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 cino= cino=g0 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 public: public:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 a = b; a = b;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 private: private:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 hN Place statements occurring after a C++ scope declaration N
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 characters from the indent of the label. (default
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 cino= cino=h10 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 public: public: a = a + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 a = a + 1; b = b + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 pN Parameter declarations for K&R-style function declarations will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 be indented N characters from the margin. (default
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 cino= cino=p0 cino=p2s >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 func(a, b) func(a, b) func(a, b)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 int a; int a; int a;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 char b; char b; char b;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 tN Indent a function return type declaration N characters from the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 margin. (default 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 cino= cino=t0 cino=t7 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 int int int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 func() func() func()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 <
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
296 iN Indent C++ base class declarations and constructor
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 initializations, if they start in a new line (otherwise they
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 are aligned at the right side of the ':').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 (default 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 cino= cino=i0 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 class MyClass : class MyClass :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 public BaseClass public BaseClass
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 {} {}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 MyClass::MyClass() : MyClass::MyClass() :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 BaseClass(3) BaseClass(3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 {} {}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 +N Indent a continuation line (a line that spills onto the next) N
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 additional characters. (default 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 cino= cino=+10 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 a = b + 9 * a = b + 9 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 c; c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 cN Indent comment lines after the comment opener, when there is no
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 other text with which to align, N characters from the comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 opener. (default 3). See also |format-comments|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 cino= cino=c5 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 /* /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 text. text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 */ */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 CN When N is non-zero, indent comment lines by the amount specified
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 with the c flag above even if there is other text behind the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 comment opener. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 cino=c0 cino=c0,C1 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 /******** /********
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 text. text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 ********/ ********/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 < (Example uses ":set comments& comments-=s1:/* comments^=s0:/*")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
335 /N Indent comment lines N characters extra. (default 0).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 cino= cino=/4 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 a = b; a = b;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 /* comment */ /* comment */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 c = d; c = d;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 (N When in unclosed parentheses, indent N characters from the line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 with the unclosed parentheses. Add a 'shiftwidth' for every
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 unclosed parentheses. When N is 0 or the unclosed parentheses
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 is the first non-white character in its line, line up with the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 next non-white character after the unclosed parentheses.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 (default 'shiftwidth' * 2).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 cino= cino=(0 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 if (c1 && (c2 || if (c1 && (c2 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 c3)) c3))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 if (c1 && if (c1 &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 (c2 || c3)) (c2 || c3))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 uN Same as (N, but for one level deeper. (default 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 cino= cino=u2 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 if (c123456789 if (c123456789
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 && (c22345 && (c22345
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 || c3)) || c3))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 UN When N is non-zero, do not ignore the indenting specified by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 ( or u in case that the unclosed parentheses is the first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 non-white character in its line. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 cino= or cino=(s cino=(s,U1 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 c = c1 && c = c1 &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 ( (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 c2 || c2 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 c3 c3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 ) && c4; ) && c4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 wN When in unclosed parentheses and N is non-zero and either
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 using "(0" or "u0", respectively, or using "U0" and the unclosed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 parentheses is the first non-white character in its line, line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 up with the character immediately after the unclosed parentheses
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 rather than the first non-white character. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 cino=(0 cino=(0,w1 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 if ( c1 if ( c1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 && ( c2 && ( c2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 || c3)) || c3))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384 foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 WN When in unclosed parentheses and N is non-zero and either
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 using "(0" or "u0", respectively and the unclosed parentheses is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 the last non-white character in its line and it is not the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 closing parentheses, indent the following line N characters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 relative to the outer context (i.e. start of the line or the
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
391 next unclosed parentheses). (default: 0).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 cino=(0 cino=(0,W4 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 a_long_line( a_long_line(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 argument, argument,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 argument); argument);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 a_short_line(argument, a_short_line(argument,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 argument); argument);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 mN When N is non-zero, line up a line starting with a closing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 parentheses with the first character of the line with the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 matching opening parentheses. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 cino=(s cino=(s,m1 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 c = c1 && ( c = c1 && (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 c2 || c2 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 c3 c3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 ) && c4; ) && c4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 if ( if (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 c1 && c2 c1 && c2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 ) )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 <
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
414 MN When N is non-zero, line up a line starting with a closing
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
415 parentheses with the first character of the previous line.
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
416 (default 0).
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
417
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
418 cino= cino=M1 >
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
419 if (cond1 && if (cond1 &&
856
8cd729851562 updated for version 7.0g
vimboss
parents: 843
diff changeset
420 cond2 cond2
8cd729851562 updated for version 7.0g
vimboss
parents: 843
diff changeset
421 ) )
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
422 <
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 *java-cinoptions* *java-indenting*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 jN Indent java anonymous classes correctly. The value 'N' is
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
425 currently unused but must be non-zero (e.g. 'j1'). 'j1' will
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 indent for example the following code snippet correctly: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 object.add(new ChangeListener() {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 public void stateChanged(ChangeEvent e) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 do_something();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432 });
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 )N Vim searches for unclosed parentheses at most N lines away.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 This limits the time needed to search for parentheses. (default
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 20 lines).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 *N Vim searches for unclosed comments at most N lines away. This
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 limits the time needed to search for the start of a comment.
2072
4a1bcdd9ea55 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2033
diff changeset
440 (default 70 lines).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441
1096
83eda510dbc0 updated for version 7.0-222
vimboss
parents: 874
diff changeset
442 #N When N is non-zero recognize shell/Perl comments, starting with
83eda510dbc0 updated for version 7.0-222
vimboss
parents: 874
diff changeset
443 '#'. Default N is zero: don't recognizes '#' comments. Note
83eda510dbc0 updated for version 7.0-222
vimboss
parents: 874
diff changeset
444 that lines starting with # will still be seen as preprocessor
83eda510dbc0 updated for version 7.0-222
vimboss
parents: 874
diff changeset
445 lines.
83eda510dbc0 updated for version 7.0-222
vimboss
parents: 874
diff changeset
446
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448 The defaults, spelled out in full, are:
15
631143ac4a01 updated for version 7.0007
vimboss
parents: 7
diff changeset
449 cinoptions=>s,e0,n0,f0,{0,}0,^0,:s,=s,l0,b0,gs,hs,ps,ts,is,+s,c3,C0,
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2072
diff changeset
450 /0,(2s,us,U0,w0,W0,m0,j0,)20,*70,#0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452 Vim puts a line in column 1 if:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 - It starts with '#' (preprocessor directives), if 'cinkeys' contains '#'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 - It starts with a label (a keyword followed by ':', other than "case" and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455 "default").
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 - Any combination of indentations causes the line to have less than 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457 indentation.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 2. Indenting by expression *indent-expression*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 The basics for using flexible indenting are explained in section |30.3| of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463 user manual.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465 If you want to write your own indent file, it must set the 'indentexpr'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466 option. Setting the 'indentkeys' option is often useful. See the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467 $VIMRUNTIME/indent directory for examples.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470 REMARKS ABOUT SPECIFIC INDENT FILES ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472
501
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 236
diff changeset
473 FORTRAN *ft-fortran-indent*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
474
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
475 Block if, select case, and where constructs are indented. Comments, labelled
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
476 statements and continuation lines are indented if the Fortran is in free
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
477 source form, whereas they are not indented if the Fortran is in fixed source
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
478 form because of the left margin requirements. Hence manual indent corrections
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 will be necessary for labelled statements and continuation lines when fixed
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
480 source form is being used. For further discussion of the method used for the
501
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 236
diff changeset
481 detection of source format see |ft-fortran-syntax|.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 Do loops ~
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
484 All do loops are left unindented by default. Do loops can be unstructured in
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 Fortran with (possibly multiple) loops ending on a labelled executable
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
486 statement of almost arbitrary type. Correct indentation requires
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
487 compiler-quality parsing. Old code with do loops ending on labelled statements
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 of arbitrary type can be indented with elaborate programs such as Tidy
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
489 (http://www.unb.ca/chem/ajit/f_tidy.htm). Structured do/continue loops are
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 also left unindented because continue statements are also used for purposes
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
491 other than ending a do loop. Programs such as Tidy can convert structured
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
492 do/continue loops to the do/enddo form. Do loops of the do/enddo variety can
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
493 be indented. If you use only structured loops of the do/enddo form, you should
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 declare this by setting the fortran_do_enddo variable in your .vimrc as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 follows >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497 let fortran_do_enddo=1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
499 in which case do loops will be indented. If all your loops are of do/enddo
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 type only in, say, .f90 files, then you should set a buffer flag with an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 autocommand such as >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 au! BufRead,BufNewFile *.f90 let b:fortran_do_enddo=1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 to get do loops indented in .f90 files and left alone in Fortran files with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506 other extensions such as .for.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
509 PHP *ft-php-indent* *php-indent* *php-indenting*
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
510
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
511 NOTE: PHP files will be indented correctly only if PHP |syntax| is active.
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
512
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
513 If you are editing a file in Unix 'fileformat' and '\r' characters are present
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
514 before new lines, indentation won't proceed correctly ; you have to remove
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
515 those useless characters first with a command like: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
516
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
517 :%s /\r$//g
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
518
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
519 Or, you can simply |:let| the variable PHP_removeCRwhenUnix to 1 and the
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
520 script will silently remove them when Vim loads a PHP file (at each|BufRead|).
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
521
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
522 OPTIONS: ~
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
523
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
524 PHP indenting can be altered in several ways by modifying the values of some
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
525 variables:
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
526
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
527 *php-comment*
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
528 To not enable auto-formating of comments by default (if you want to use your
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
529 own 'formatoptions'): >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
530 :let g:PHP_autoformatcomment = 0
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
531
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
532 Else, 't' will be removed from the 'formatoptions' string and "qrowcb" will be
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
533 added, see|fo-table|for more information.
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
534 -------------
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
535
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
536 To add an extra indent to every PHP lines with N being the number of
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
537 'shiftwidth' to add: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
538 :let g:PHP_default_indenting = N
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
539
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
540 For example, with N = 1, this will give:
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
541 >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
542 <?php
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
543 if (!isset($History_lst_sel))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
544 if (!isset($History_lst_sel))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
545 if (!isset($History_lst_sel)) {
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
546 $History_lst_sel=0;
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
547 } else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
548 $foo="bar";
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
549
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
550 $command_hist = TRUE;
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
551 ?>
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
552 (Notice the extra indent between the PHP container markers and the code)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
553 -------------
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
554
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
555 To automatically remove '\r' characters when the 'fileformat' is set to Unix: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
556 :let g:PHP_removeCRwhenUnix = 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
557 -------------
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
558
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
559 To indent braces at the same level than the code they contain: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
560 :let g:PHP_BracesAtCodeLevel = 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
561
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
562 This will give the following result: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
563 if ($foo)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
564 {
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
565 foo();
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
566 }
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
567 Instead of: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
568 if ($foo)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
569 {
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
570 foo();
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
571 }
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
572
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
573 NOTE: Indenting will be a bit slower if this option is used because some
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
574 optimizations won't be available.
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
575 -------------
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
576
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
577 To indent 'case:' and 'default:' statements in switch() blocks: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
578 :let g:PHP_vintage_case_default_indent = 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
579
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
580 (By default they are indented at the same level than the 'switch()' to avoid
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
581 unnecessary indentation)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
582
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
583
501
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 236
diff changeset
584 PYTHON *ft-python-indent*
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
585
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
586 The amount of indent can be set for the following situations. The examples
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
587 given are the defaults. Note that the variables are set to an expression, so
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
588 that you can change the value of 'shiftwidth' later.
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
589
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
590 Indent after an open paren: >
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
591 let g:pyindent_open_paren = '&sw * 2'
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
592 Indent after a nested paren: >
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
593 let g:pyindent_nested_paren = '&sw'
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
594 Indent for a continuation line: >
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
595 let g:pyindent_continue = '&sw * 2'
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
596
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
597
1201
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
598 SHELL *ft-sh-indent*
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
599
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
600 The amount of indent applied under various circumstances in a shell file can
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
601 be configured by setting the following keys in the |Dictionary|
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
602 b:sh_indent_defaults to a specific amount or to a |Funcref| that references a
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
603 function that will return the amount desired:
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
604
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
605 b:sh_indent_options['default'] Default amount of indent.
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
606
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
607 b:sh_indent_options['continuation-line']
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
608 Amount of indent to add to a continued line.
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
609
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
610 b:sh_indent_options['case-labels']
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
611 Amount of indent to add for case labels.
2033
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
612 (not actually implemented)
1201
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
613
2033
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
614 b:sh_indent_options['case-statements']
1201
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
615 Amount of indent to add for case statements.
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
616
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
617 b:sh_indent_options['case-breaks']
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
618 Amount of indent to add (or more likely
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
619 remove) for case breaks.
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
620
501
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 236
diff changeset
621 VERILOG *ft-verilog-indent*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
622
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623 General block statements such as if, for, case, always, initial, function,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 specify and begin, etc., are indented. The module block statements (first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
625 level blocks) are not indented by default. you can turn on the indent with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626 setting a variable in the .vimrc as follows: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 let b:verilog_indent_modules = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
630 then the module blocks will be indented. To stop this, remove the variable: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
631
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 :unlet b:verilog_indent_modules
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634 To set the variable only for Verilog file. The following statements can be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635 used: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
637 au BufReadPost * if exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
638 au BufReadPost * if b:current_syntax == "verilog"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
639 au BufReadPost * let b:verilog_indent_modules = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
640 au BufReadPost * endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
641 au BufReadPost * endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
642
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643 Furthermore, setting the variable b:verilog_indent_width to change the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644 indenting width (default is 'shiftwidth'): >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
645
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646 let b:verilog_indent_width = 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647 let b:verilog_indent_width = &sw * 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
649 In addition, you can turn the verbose mode for debug issue: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
650
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651 let b:verilog_indent_verbose = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653 Make sure to do ":set cmdheight=2" first to allow the display of the message.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
655
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
656 VHDL *ft-vhdl-indent*
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
657
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
658 Alignment of generic/port mapping statements are performed by default. This
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
659 causes the following alignment example: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
660
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
661 ENTITY sync IS
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
662 PORT (
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
663 clk : IN STD_LOGIC;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
664 reset_n : IN STD_LOGIC;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
665 data_input : IN STD_LOGIC;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
666 data_out : OUT STD_LOGIC
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
667 );
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
668 END ENTITY sync;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
669
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
670 To turn this off, add >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
671
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
672 let g:vhdl_indent_genportmap = 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
673
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
674 to the .vimrc file, which causes the previous alignment example to change: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
675
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
676 ENTITY sync IS
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
677 PORT (
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
678 clk : IN STD_LOGIC;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
679 reset_n : IN STD_LOGIC;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
680 data_input : IN STD_LOGIC;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
681 data_out : OUT STD_LOGIC
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
682 );
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
683 END ENTITY sync;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
684
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
685 ----------------------------------------
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
686
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
687 Alignment of right-hand side assignment "<=" statements are performed by
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
688 default. This causes the following alignment example: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
689
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
690 sig_out <= (bus_a(1) AND
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
691 (sig_b OR sig_c)) OR
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
692 (bus_a(0) AND sig_d);
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
693
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
694 To turn this off, add >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
695
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
696 let g:vhdl_indent_rhsassign = 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
697
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
698 to the .vimrc file, which causes the previous alignment example to change: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
699
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
700 sig_out <= (bus_a(1) AND
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
701 (sig_b OR sig_c)) OR
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
702 (bus_a(0) AND sig_d);
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
703
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
704 ----------------------------------------
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
705
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
706 Full-line comments (lines that begin with "--") are indented to be aligned with
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
707 the very previous line's comment, PROVIDED that a whitespace follows after
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
708 "--".
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
709
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
710 For example: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
711
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
712 sig_a <= sig_b; -- start of a comment
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
713 -- continuation of the comment
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
714 -- more of the same comment
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
715
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
716 While in Insert mode, after typing "-- " (note the space " "), hitting CTRL-F
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
717 will align the current "-- " with the previous line's "--".
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
718
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
719 If the very previous line does not contain "--", THEN the full-line comment
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
720 will be aligned with the start of the next non-blank line that is NOT a
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
721 full-line comment.
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
722
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
723 Indenting the following code: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
724
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
725 sig_c <= sig_d; -- comment 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
726 -- comment 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
727 -- comment 2
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
728 --debug_code:
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
729 --PROCESS(debug_in)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
730 --BEGIN
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
731 -- FOR i IN 15 DOWNTO 0 LOOP
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
732 -- debug_out(8*i+7 DOWNTO 8*i) <= debug_in(15-i);
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
733 -- END LOOP;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
734 --END PROCESS debug_code;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
735
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
736 -- comment 3
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
737 sig_e <= sig_f; -- comment 4
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
738 -- comment 5
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
739
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
740 results in: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
741
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
742 sig_c <= sig_d; -- comment 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
743 -- comment 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
744 -- comment 2
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
745 --debug_code:
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
746 --PROCESS(debug_in)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
747 --BEGIN
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
748 -- FOR i IN 15 DOWNTO 0 LOOP
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
749 -- debug_out(8*i+7 DOWNTO 8*i) <= debug_in(15-i);
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
750 -- END LOOP;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
751 --END PROCESS debug_code;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
752
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
753 -- comment 3
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
754 sig_e <= sig_f; -- comment 4
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
755 -- comment 5
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
756
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
757 Notice that "--debug_code:" does not align with "-- comment 2"
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
758 because there is no whitespace that follows after "--" in "--debug_code:".
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
759
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
760 Given the dynamic nature of indenting comments, indenting should be done TWICE.
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
761 On the first pass, code will be indented. On the second pass, full-line
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
762 comments will be indented according to the correctly indented code.
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
763
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
764
501
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 236
diff changeset
765 VIM *ft-vim-indent*
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
766
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
767 For indenting Vim scripts there is one variable that specifies the amount of
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
768 indent for a continuation line, a line that starts with a backslash: >
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
769
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
770 :let g:vim_indent_cont = &sw * 3
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
771
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
772 Three times shiftwidth is the default value.
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
773
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
774
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
775 vim:tw=78:ts=8:ft=help:norl: