annotate runtime/doc/indent.txt @ 4541:80170d61a85c v7.3.1018

updated for version 7.3.1018 Problem: New regexp engine wastes memory. Solution: Allocate prog with actual number of states, not estimated maximum number of sates.
author Bram Moolenaar <bram@vim.org>
date Sat, 25 May 2013 21:18:34 +0200
parents 605c9ce57ec3
children a5352e73dc00
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
1 *indent.txt* For Vim version 7.3. Last change: 2013 May 20
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*
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
131 The 'cinoptions' option sets how Vim performs indentation. The value after
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
132 the option character can be one of these (N is any number):
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
133 N indent N spaces
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
134 -N indent N spaces to the left
3082
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
135 Ns N times 'shiftwidth' spaces
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
136 -Ns N times 'shiftwidth' spaces to the left
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
137
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
138 In the list below,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 "N" represents a number of your choice (the number can be negative). When
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 there is an 's' after the number, Vim multiplies the number by 'shiftwidth':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 "1s" is 'shiftwidth', "2s" is two times 'shiftwidth', etc. You can use a
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
142 decimal point, too: "-0.5s" is minus half a 'shiftwidth'.
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
143 The examples below assume a 'shiftwidth' of 4.
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
144 *cino->*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 >N Amount added for "normal" indent. Used after a line that should
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 increase the indent (lines starting with "if", an opening brace,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 etc.). (default 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 cino= cino=>2 cino=>2s >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 if (cond) if (cond) if (cond)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 foo; foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
155 *cino-e*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 eN Add N to the prevailing indent inside a set of braces if the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 opening brace at the End of the line (more precise: is not the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 first character in a line). This is useful if you want a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 different indent when the '{' is at the start of the line from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 when '{' is at the end of the line. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 cino= cino=e2 cino=e-2 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 if (cond) { if (cond) { if (cond) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 foo; foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 else else else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 bar; bar; bar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
171 *cino-n*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 nN Add N to the prevailing indent for a statement after an "if",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 "while", etc., if it is NOT inside a set of braces. This is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 useful if you want a different indent when there is no '{'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 before the statement from when there is a '{' before it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 cino= cino=n2 cino=n-2 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 if (cond) if (cond) if (cond)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 foo; foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 else else else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 bar; bar; bar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
186 *cino-f*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 fN Place the first opening brace of a function or other block in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 column N. This applies only for an opening brace that is not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 inside other braces and is at the start of the line. What comes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 after the brace is put relative to this brace. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 cino= cino=f.5s cino=f1s >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 func() func() func()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 int foo; int foo; int foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
197 *cino-{*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 {N Place opening braces N characters from the prevailing indent.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 This applies only for opening braces that are inside other
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 braces. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 cino= cino={.5s cino={1s >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 if (cond) if (cond) if (cond)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 foo; foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
207 *cino-}*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 }N Place closing braces N characters from the matching opening
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 brace. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 cino= cino={2,}-0.5s cino=}2 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 if (cond) if (cond) if (cond)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 foo; foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
217 *cino-^*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 ^N Add N to the prevailing indent inside a set of braces if the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 opening brace is in column 0. This can specify a different
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 indent for whole of a function (some may like to set it to a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 negative number). (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 cino= cino=^-2 cino=^-s >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 func() func() func()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 if (cond) if (cond) if (cond)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 { { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 a = b; a = b; a = b;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 } } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
232 *cino-L*
2328
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
233 LN Controls placement of jump labels. If N is negative, the label
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
234 will be placed at column 1. If N is non-negative, the indent of
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
235 the label will be the prevailing indent minus N. (default -1).
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
236
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
237 cino= cino=L2 cino=Ls >
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
238 func() func() func()
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
239 { { {
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
240 { { {
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
241 stmt; stmt; stmt;
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
242 LABEL: LABEL: LABEL:
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
243 } } }
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
244 } } }
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
245 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
246 *cino-:*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 :N Place case labels N characters from the indent of the switch().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 (default 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 cino= cino=:0 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 switch (x) switch(x)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 case 1: case 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 a = b; a = b;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 default: default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
258 *cino-=*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 =N Place statements occurring after a case label N characters from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 the indent of the label. (default 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 cino= cino==10 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 case 11: case 11: a = a + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 a = a + 1; b = b + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
266 *cino-l*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 lN If N != 0 Vim will align with a case label instead of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 statement after it in the same line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 cino= cino=l1 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 switch (a) { switch (a) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 case 1: { case 1: {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 break; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
276 *cino-b*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 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
278 so that case..break looks like a sort of block. (default: 0).
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
279 When using 1, consider adding "0=break" to 'cinkeys'.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 cino= cino=b1 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 switch (x) switch(x)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 case 1: case 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 a = b; a = b;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 break; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 default: default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 a = 0; a = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 break; break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
293 *cino-g*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 gN Place C++ scope declarations N characters from the indent of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 block they are in. (default 'shiftwidth'). A scope declaration
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 can be "public:", "protected:" or "private:".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 cino= cino=g0 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 public: public:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 a = b; a = b;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 private: private:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 } }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
305 *cino-h*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 hN Place statements occurring after a C++ scope declaration N
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 characters from the indent of the label. (default
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 cino= cino=h10 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 public: public: a = a + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 a = a + 1; b = b + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
314 *cino-N*
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
315 NN Indent inside C++ namespace N characters extra compared to a
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
316 normal block. (default 0).
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
317
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
318 cino= cino=N-s >
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
319 namespace { namespace {
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
320 void function(); void function();
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
321 } }
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
322
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
323 namespace my namespace my
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
324 { {
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
325 void function(); void function();
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
326 } }
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
327 <
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
328 *cino-p*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 pN Parameter declarations for K&R-style function declarations will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 be indented N characters from the margin. (default
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 cino= cino=p0 cino=p2s >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 func(a, b) func(a, b) func(a, b)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 int a; int a; int a;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 char b; char b; char b;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
338 *cino-t*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 tN Indent a function return type declaration N characters from the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 margin. (default 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 cino= cino=t0 cino=t7 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 int int int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 func() func() func()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
346 *cino-i*
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
347 iN Indent C++ base class declarations and constructor
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 initializations, if they start in a new line (otherwise they
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 are aligned at the right side of the ':').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 (default 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 cino= cino=i0 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 class MyClass : class MyClass :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 public BaseClass public BaseClass
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 {} {}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 MyClass::MyClass() : MyClass::MyClass() :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 BaseClass(3) BaseClass(3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 {} {}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
360 *cino-+*
2725
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2698
diff changeset
361 +N Indent a continuation line (a line that spills onto the next)
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2698
diff changeset
362 inside a function N additional characters. (default
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2698
diff changeset
363 'shiftwidth').
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2698
diff changeset
364 Outside of a function, when the previous line ended in a
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2698
diff changeset
365 backslash, the 2 * N is used.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 cino= cino=+10 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 a = b + 9 * a = b + 9 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 c; c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
371 *cino-c*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 cN Indent comment lines after the comment opener, when there is no
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 other text with which to align, N characters from the comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 opener. (default 3). See also |format-comments|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 cino= cino=c5 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 /* /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 text. text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 */ */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
381 *cino-C*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 CN When N is non-zero, indent comment lines by the amount specified
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 with the c flag above even if there is other text behind the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384 comment opener. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 cino=c0 cino=c0,C1 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 /******** /********
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 text. text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 ********/ ********/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 < (Example uses ":set comments& comments-=s1:/* comments^=s0:/*")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
392 *cino-/*
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
393 /N Indent comment lines N characters extra. (default 0).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 cino= cino=/4 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 a = b; a = b;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 /* comment */ /* comment */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 c = d; c = d;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
399 *cino-(*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 (N When in unclosed parentheses, indent N characters from the line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 with the unclosed parentheses. Add a 'shiftwidth' for every
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 unclosed parentheses. When N is 0 or the unclosed parentheses
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 is the first non-white character in its line, line up with the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 next non-white character after the unclosed parentheses.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 (default 'shiftwidth' * 2).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 cino= cino=(0 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 if (c1 && (c2 || if (c1 && (c2 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 c3)) c3))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 if (c1 && if (c1 &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 (c2 || c3)) (c2 || c3))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 { {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
415 *cino-u*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 uN Same as (N, but for one level deeper. (default 'shiftwidth').
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 cino= cino=u2 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 if (c123456789 if (c123456789
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 && (c22345 && (c22345
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 || c3)) || c3))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
423 *cino-U*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 UN When N is non-zero, do not ignore the indenting specified by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 ( or u in case that the unclosed parentheses is the first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 non-white character in its line. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 cino= or cino=(s cino=(s,U1 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 c = c1 && c = c1 &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 ( (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431 c2 || c2 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432 c3 c3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 ) && c4; ) && c4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 <
3082
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
435 *cino-w*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 wN When in unclosed parentheses and N is non-zero and either
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 using "(0" or "u0", respectively, or using "U0" and the unclosed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 parentheses is the first non-white character in its line, line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 up with the character immediately after the unclosed parentheses
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 rather than the first non-white character. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 cino=(0 cino=(0,w1 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 if ( c1 if ( c1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 && ( c2 && ( c2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445 || c3)) || c3))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
448 *cino-W*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 WN When in unclosed parentheses and N is non-zero and either
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450 using "(0" or "u0", respectively and the unclosed parentheses is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 the last non-white character in its line and it is not the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452 closing parentheses, indent the following line N characters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 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
454 next unclosed parentheses). (default: 0).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 cino=(0 cino=(0,W4 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457 a_long_line( a_long_line(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 argument, argument,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459 argument); argument);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 a_short_line(argument, a_short_line(argument,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 argument); argument);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 <
3454
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
463 *cino-k*
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
464 kN When in unclosed parentheses which follow "if", "for" or
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
465 "while" and N is non-zero, overrides the behaviour defined by
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
466 "(N": causes the indent to be N characters relative to the outer
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
467 context (i.e. the line where "if", "for" or "while" is). Has
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
468 no effect on deeper levels of nesting. Affects flags like "wN"
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
469 only for the "if", "for" and "while" conditions. If 0, defaults
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
470 to behaviour defined by the "(N" flag. (default: 0).
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
471
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
472 cino=(0 cino=(0,ks >
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
473 if (condition1 if (condition1
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
474 && condition2) && condition2)
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
475 action(); action();
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
476 function(argument1 function(argument1
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
477 && argument2); && argument2);
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
478 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
479 *cino-m*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480 mN When N is non-zero, line up a line starting with a closing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481 parentheses with the first character of the line with the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482 matching opening parentheses. (default 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484 cino=(s cino=(s,m1 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 c = c1 && ( c = c1 && (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486 c2 || c2 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487 c3 c3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 ) && c4; ) && c4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489 if ( if (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 c1 && c2 c1 && c2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 ) )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492 foo; foo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
494 *cino-M*
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
495 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
496 parentheses with the first character of the previous line.
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
497 (default 0).
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
498
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
499 cino= cino=M1 >
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
500 if (cond1 && if (cond1 &&
856
8cd729851562 updated for version 7.0g
vimboss
parents: 843
diff changeset
501 cond2 cond2
8cd729851562 updated for version 7.0g
vimboss
parents: 843
diff changeset
502 ) )
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 825
diff changeset
503 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
504 *java-cinoptions* *java-indenting* *cino-j*
2965
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
505 jN Indent Java anonymous classes correctly. Also works well for
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
506 Javascript. The value 'N' is currently unused but must be
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
507 non-zero (e.g. 'j1'). 'j1' will indent for example the
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
508 following code snippet correctly: >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
509
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510 object.add(new ChangeListener() {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511 public void stateChanged(ChangeEvent e) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
512 do_something();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 });
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
516 *javascript-cinoptions* *javascript-indenting* *cino-J*
2297
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
517 JN Indent JavaScript object declarations correctly by not confusing
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
518 them with labels. The value 'N' is currently unused but must be
2965
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
519 non-zero (e.g. 'J1'). If you enable this you probably also want
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
520 to set |cino-j|. >
2297
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
521
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
522 var bar = {
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
523 foo: {
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
524 that: this,
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
525 some: ok,
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
526 },
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
527 "bar":{
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
528 a : 2,
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
529 b: "123abc",
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
530 x: 4,
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
531 "y": 5
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
532 }
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
533 }
5ffe000a9ecf Improve Javascript indenting. Add "J" flag to 'cino'. (Hari Kumar G)
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
534 <
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
535 *cino-)*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
536 )N Vim searches for unclosed parentheses at most N lines away.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
537 This limits the time needed to search for parentheses. (default
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
538 20 lines).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
539
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
540 *cino-star*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
541 *N Vim searches for unclosed comments at most N lines away. This
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 limits the time needed to search for the start of a comment.
3830
04592728474a Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3454
diff changeset
543 If your /* */ comments stop indenting after N lines this is the
2788
0877b8d6370e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2725
diff changeset
544 value you will want to change.
2072
4a1bcdd9ea55 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2033
diff changeset
545 (default 70 lines).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
547 *cino-#*
1096
83eda510dbc0 updated for version 7.0-222
vimboss
parents: 874
diff changeset
548 #N When N is non-zero recognize shell/Perl comments, starting with
3454
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
549 '#'. Default N is zero: don't recognize '#' comments. Note
1096
83eda510dbc0 updated for version 7.0-222
vimboss
parents: 874
diff changeset
550 that lines starting with # will still be seen as preprocessor
83eda510dbc0 updated for version 7.0-222
vimboss
parents: 874
diff changeset
551 lines.
83eda510dbc0 updated for version 7.0-222
vimboss
parents: 874
diff changeset
552
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 The defaults, spelled out in full, are:
2857
f80e67bd6271 updated for version 7.3.202
Bram Moolenaar <bram@vim.org>
parents: 2788
diff changeset
555 cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:s,=s,l0,b0,gs,hs,N0,ps,ts,is,+s,
3454
214c7ec1c8f9 updated for version 7.3.492
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
556 c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,j0,J0,)20,*70,#0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558 Vim puts a line in column 1 if:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 - It starts with '#' (preprocessor directives), if 'cinkeys' contains '#'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560 - It starts with a label (a keyword followed by ':', other than "case" and
2328
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
561 "default") and 'cinoptions' does not contain an 'L' entry with a positive
15379284e55a Add the 'L' item to 'cinoptions'. (Manuel Konig)
Bram Moolenaar <bram@vim.org>
parents: 2297
diff changeset
562 value.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563 - Any combination of indentations causes the line to have less than 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
564 indentation.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
565
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
566 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
567 2. Indenting by expression *indent-expression*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
568
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
569 The basics for using flexible indenting are explained in section |30.3| of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570 user manual.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
572 If you want to write your own indent file, it must set the 'indentexpr'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573 option. Setting the 'indentkeys' option is often useful. See the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574 $VIMRUNTIME/indent directory for examples.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
575
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
576
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
577 REMARKS ABOUT SPECIFIC INDENT FILES ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
579
4098
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
580 CLOJURE *ft-clojure-indent* *clojure-indent*
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
581
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
582 Clojure indentation differs somewhat from traditional Lisps, due in part to
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
583 the use of square and curly brackets, and otherwise by community convention.
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
584 These conventions are not always universally followed, so the Clojure indent
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
585 script offers a few configurable options, listed below.
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
586
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
587 If the current vim does not include searchpairpos(), the indent script falls
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
588 back to normal 'lisp' indenting, and the following options are ignored.
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
589
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
590 *g:clojure_maxlines*
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
591
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
592 Set maximum scan distance of searchpairpos(). Larger values trade performance
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
593 for correctness when dealing with very long forms. A value of 0 will scan
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
594 without limits.
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
595 >
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
596 " Default
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
597 let g:clojure_maxlines = 100
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
598 <
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
599
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
600 *g:clojure_fuzzy_indent*
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
601 *g:clojure_fuzzy_indent_patterns*
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
602 *g:clojure_fuzzy_indent_blacklist*
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
603
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
604 The 'lispwords' option is a list of comma-separated words that mark special
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
605 forms whose subforms must be indented with two spaces.
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
606
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
607 For example:
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
608 >
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
609 (defn bad []
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
610 "Incorrect indentation")
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
611
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
612 (defn good []
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
613 "Correct indentation")
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
614 <
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
615 If you would like to specify 'lispwords' with a |pattern| instead, you can use
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
616 the fuzzy indent feature:
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
617 >
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
618 " Default
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
619 let g:clojure_fuzzy_indent = 1
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
620 let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let']
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
621 let g:clojure_fuzzy_indent_blacklist =
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
622 \ ['-fn$', '\v^with-%(meta|out-str|loading-context)$']
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
623
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
624 " Legacy comma-delimited string version; the list format above is
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
625 " recommended. Note that patterns are implicitly anchored with ^ and $
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
626 let g:clojure_fuzzy_indent_patterns = 'with.*,def.*,let.*'
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
627 <
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
628 |g:clojure_fuzzy_indent_patterns| and |g:clojure_fuzzy_indent_blacklist| are
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
629 |Lists| of patterns that will be matched against the unquoted, unqualified
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
630 symbol at the head of a list. This means that a pattern like "^foo" will match
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
631 all these candidates: "foobar", "my.ns/foobar", and "#'foobar".
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
632
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
633 Each candidate word is tested for special treatment in this order:
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
634
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
635 1. Return true if word is literally in 'lispwords'
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
636 2. Return false if word matches a pattern in
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
637 |g:clojure_fuzzy_indent_blacklist|
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
638 3. Return true if word matches a pattern in
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
639 |g:clojure_fuzzy_indent_patterns|
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
640 4. Return false and indent normally otherwise
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
641
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
642 *g:clojure_special_indent_words*
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
643
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
644 Some forms in Clojure are indented so that every subform is indented only two
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
645 spaces, regardless of 'lispwords'. If you have a custom construct that should
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
646 be indented in this idiosyncratic fashion, you can add your symbols to the
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
647 default list below.
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
648 >
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
649 " Default
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
650 let g:clojure_special_indent_words =
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
651 \ 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn'
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
652 <
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
653
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
654 *g:clojure_align_multiline_strings*
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
655
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
656 Align subsequent lines in multiline strings to the column after the opening
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
657 quote, instead of the same column.
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
658
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
659 For example:
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
660 >
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
661 (def default
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
662 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
663 eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
664 enim ad minim veniam, quis nostrud exercitation ullamco laboris
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
665 nisi ut aliquip ex ea commodo consequat.")
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
666
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
667 (def aligned
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
668 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
669 eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
670 enim ad minim veniam, quis nostrud exercitation ullamco laboris
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
671 nisi ut aliquip ex ea commodo consequat.")
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
672 <
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
673 This option is off by default.
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
674 >
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
675 " Default
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
676 let g:clojure_align_multiline_strings = 0
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
677 <
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
678
058f26a834c4 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
679
501
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 236
diff changeset
680 FORTRAN *ft-fortran-indent*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
682 Block if, select case, where, and forall constructs are indented. So are
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
683 type, interface, associate, block, and enum constructs. The indenting of
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
684 subroutines, functions, modules, and program blocks is optional. Comments,
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
685 labelled statements and continuation lines are indented if the Fortran is in
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
686 free source form, whereas they are not indented if the Fortran is in fixed
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
687 source form because of the left margin requirements. Hence manual indent
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
688 corrections will be necessary for labelled statements and continuation lines
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
689 when fixed source form is being used. For further discussion of the method
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
690 used for the detection of source format see |ft-fortran-syntax|.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
691
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 Do loops ~
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
693 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
694 Fortran with (possibly multiple) loops ending on a labelled executable
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
695 statement of almost arbitrary type. Correct indentation requires
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
696 compiler-quality parsing. Old code with do loops ending on labelled statements
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
697 of arbitrary type can be indented with elaborate programs such as Tidy
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
698 (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
699 also left unindented because continue statements are also used for purposes
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
700 other than ending a do loop. Programs such as Tidy can convert structured
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
701 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
702 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
703 declare this by setting the fortran_do_enddo variable in your .vimrc as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
704 follows >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
705
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
706 let fortran_do_enddo=1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
707
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 170
diff changeset
708 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
709 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
710 autocommand such as >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 au! BufRead,BufNewFile *.f90 let b:fortran_do_enddo=1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
713
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714 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
715 other extensions such as .for.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
716
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
717 Program units ~
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
718 The indenting of program units (subroutines, functions, modules, and program
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
719 blocks) is enabled by default but can be suppressed if a lighter, screen-width
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
720 preserving indent style is desired. To suppress the indenting of program
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
721 units for all fortran files set the global fortran_indent_less variable in
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
722 your .vimrc as follows >
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
723
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
724 let fortran_indent_less=1
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
725
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
726 A finer level of suppression can be achieved by setting the corresponding
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
727 buffer-local variable as follows >
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
728
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
729 let b:fortran_indent_less=1
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2857
diff changeset
730
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
732 PHP *ft-php-indent* *php-indent* *php-indenting*
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
733
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
734 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
735
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
736 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
737 before new lines, indentation won't proceed correctly ; you have to remove
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
738 those useless characters first with a command like: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
739
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
740 :%s /\r$//g
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
741
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
742 Or, you can simply |:let| the variable PHP_removeCRwhenUnix to 1 and the
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
743 script will silently remove them when Vim loads a PHP file (at each |BufRead|).
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
744
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
745 OPTIONS: ~
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
746
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
747 PHP indenting can be altered in several ways by modifying the values of some
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
748 global variables:
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
749
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
750 *php-comment*
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
751 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
752 own 'formatoptions'): >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
753 :let g:PHP_autoformatcomment = 0
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
754
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
755 Else, 't' will be removed from the 'formatoptions' string and "qrowcb" will be
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
756 added, see |fo-table| for more information.
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
757 -------------
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
758
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
759 To add extra indentation to single-line comments: >
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
760 :let g:PHP_outdentSLComments = N
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
761
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
762 With N being the number of 'shiftwidth' to add.
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
763
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
764 Only single-line comments will be affected such as: >
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
765 # Comment
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
766 // Comment
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
767 /* Comment */
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
768 -------------
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
769
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
770 To add extra indentation to every PHP lines with N being the number of
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
771 'shiftwidth' to add: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
772 :let g:PHP_default_indenting = N
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
773
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
774 For example, with N = 1, this will give:
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
775 >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
776 <?php
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
777 if (!isset($History_lst_sel))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
778 if (!isset($History_lst_sel))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
779 if (!isset($History_lst_sel)) {
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
780 $History_lst_sel=0;
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
781 } else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
782 $foo="bar";
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
783
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
784 $command_hist = TRUE;
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
785 ?>
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
786 (Notice the extra indentation between the PHP container markers and the code)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
787 -------------
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
788
2442
14f01499dd16 More updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2413
diff changeset
789 To indent PHP tags as the surrounding code: >
14f01499dd16 More updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2413
diff changeset
790 :let g:PHP_outdentphpescape = 0
14f01499dd16 More updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2413
diff changeset
791 -------------
14f01499dd16 More updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2413
diff changeset
792
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
793 To automatically remove '\r' characters when the 'fileformat' is set to Unix: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
794 :let g:PHP_removeCRwhenUnix = 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
795 -------------
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
796
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
797 To indent braces at the same level than the code they contain: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
798 :let g:PHP_BracesAtCodeLevel = 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
799
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
800 This will give the following result: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
801 if ($foo)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
802 {
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
803 foo();
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
804 }
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
805 Instead of: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
806 if ($foo)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
807 {
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
808 foo();
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
809 }
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
810
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
811 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
812 optimizations won't be available.
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
813 -------------
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
814
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
815 To indent 'case:' and 'default:' statements in switch() blocks: >
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
816 :let g:PHP_vintage_case_default_indent = 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
817
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
818 In PHP braces are not required inside 'case/default' blocks therefore 'case:'
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
819 and 'default:' are indented at the same level than the 'switch()' to avoid
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
820 meaningless indentation. You can use the above option to return to the
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4098
diff changeset
821 traditional way.
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
822
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
823
501
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 236
diff changeset
824 PYTHON *ft-python-indent*
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
825
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
826 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
827 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
828 that you can change the value of 'shiftwidth' later.
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
829
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
830 Indent after an open paren: >
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
831 let g:pyindent_open_paren = '&sw * 2'
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
832 Indent after a nested paren: >
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
833 let g:pyindent_nested_paren = '&sw'
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
834 Indent for a continuation line: >
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
835 let g:pyindent_continue = '&sw * 2'
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
836
8c60f65311fa updated for version 7.0052
vimboss
parents: 22
diff changeset
837
3082
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
838 R *ft-r-indent*
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
839
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
840 Function arguments are aligned if they span for multiple lines. If you prefer
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
841 do not have the arguments of functions aligned, put in your |vimrc|:
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
842 >
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
843 let r_indent_align_args = 0
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
844 <
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
845 All lines beginning with a comment character, #, get the same indentation
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
846 level of the normal R code. Users of Emacs/ESS may be used to have lines
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
847 beginning with a single # indented in the 40th column, ## indented as R code,
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
848 and ### not indented. If you prefer that lines beginning with comment
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
849 characters are aligned as they are by Emacs/ESS, put in your |vimrc|:
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
850 >
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
851 let r_indent_ess_comments = 1
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
852 <
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
853 If you prefer that lines beginning with a single # are aligned at a column
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
854 different from the 40th one, you should set a new value to the variable
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
855 r_indent_comment_column, as in the example below:
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
856 >
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
857 let r_indent_comment_column = 30
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
858 <
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
859 Any code after a line that ends with "<-" is indented. Emacs/ESS does not
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
860 indent the code if it is a top level function. If you prefer that the
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
861 Vim-R-plugin behaves like Emacs/ESS in this regard, put in your |vimrc|:
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
862 >
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
863 let r_indent_ess_compatible = 1
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
864 <
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
865 Below is an example of indentation with and without this option enabled:
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
866 >
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
867 ### r_indent_ess_compatible = 1 ### r_indent_ess_compatible = 0
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
868 foo <- foo <-
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
869 function(x) function(x)
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
870 { {
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
871 paste(x) paste(x)
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
872 } }
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
873 <
3502a7f991fc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
874
1201
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
875 SHELL *ft-sh-indent*
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
876
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
877 The amount of indent applied under various circumstances in a shell file can
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
878 be configured by setting the following keys in the |Dictionary|
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
879 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
880 function that will return the amount desired:
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
881
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
882 b:sh_indent_options['default'] Default amount of indent.
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
883
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
884 b:sh_indent_options['continuation-line']
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
885 Amount of indent to add to a continued line.
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
886
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
887 b:sh_indent_options['case-labels']
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
888 Amount of indent to add for case labels.
2033
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
889 (not actually implemented)
1201
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
890
2033
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
891 b:sh_indent_options['case-statements']
1201
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
892 Amount of indent to add for case statements.
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
893
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
894 b:sh_indent_options['case-breaks']
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
895 Amount of indent to add (or more likely
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
896 remove) for case breaks.
4d2585cf5950 updated for version 7.1b
vimboss
parents: 1141
diff changeset
897
501
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 236
diff changeset
898 VERILOG *ft-verilog-indent*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 General block statements such as if, for, case, always, initial, function,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901 specify and begin, etc., are indented. The module block statements (first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902 level blocks) are not indented by default. you can turn on the indent with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903 setting a variable in the .vimrc as follows: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
904
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905 let b:verilog_indent_modules = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 then the module blocks will be indented. To stop this, remove the variable: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 :unlet b:verilog_indent_modules
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
911 To set the variable only for Verilog file. The following statements can be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912 used: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914 au BufReadPost * if exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915 au BufReadPost * if b:current_syntax == "verilog"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916 au BufReadPost * let b:verilog_indent_modules = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 au BufReadPost * endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 au BufReadPost * endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 Furthermore, setting the variable b:verilog_indent_width to change the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921 indenting width (default is 'shiftwidth'): >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
922
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923 let b:verilog_indent_width = 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924 let b:verilog_indent_width = &sw * 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
925
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 In addition, you can turn the verbose mode for debug issue: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 let b:verilog_indent_verbose = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
929
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 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
931
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
932
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
933 VHDL *ft-vhdl-indent*
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
934
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
935 Alignment of generic/port mapping statements are performed by default. This
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
936 causes the following alignment example: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
937
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
938 ENTITY sync IS
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
939 PORT (
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
940 clk : IN STD_LOGIC;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
941 reset_n : IN STD_LOGIC;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
942 data_input : IN STD_LOGIC;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
943 data_out : OUT STD_LOGIC
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
944 );
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
945 END ENTITY sync;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
946
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
947 To turn this off, add >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
948
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
949 let g:vhdl_indent_genportmap = 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
950
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
951 to the .vimrc file, which causes the previous alignment example to change: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
952
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
953 ENTITY sync IS
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
954 PORT (
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
955 clk : IN STD_LOGIC;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
956 reset_n : IN STD_LOGIC;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
957 data_input : IN STD_LOGIC;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
958 data_out : OUT STD_LOGIC
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
959 );
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
960 END ENTITY sync;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
961
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
962 ----------------------------------------
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
963
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
964 Alignment of right-hand side assignment "<=" statements are performed by
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
965 default. This causes the following alignment example: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
966
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
967 sig_out <= (bus_a(1) AND
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
968 (sig_b OR sig_c)) OR
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
969 (bus_a(0) AND sig_d);
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
970
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
971 To turn this off, add >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
972
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
973 let g:vhdl_indent_rhsassign = 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
974
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
975 to the .vimrc file, which causes the previous alignment example to change: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
976
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
977 sig_out <= (bus_a(1) AND
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
978 (sig_b OR sig_c)) OR
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
979 (bus_a(0) AND sig_d);
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
980
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
981 ----------------------------------------
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
982
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
983 Full-line comments (lines that begin with "--") are indented to be aligned with
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
984 the very previous line's comment, PROVIDED that a whitespace follows after
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
985 "--".
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
986
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
987 For example: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
988
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
989 sig_a <= sig_b; -- start of a comment
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
990 -- continuation of the comment
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
991 -- more of the same comment
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
992
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
993 While in Insert mode, after typing "-- " (note the space " "), hitting CTRL-F
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
994 will align the current "-- " with the previous line's "--".
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
995
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
996 If the very previous line does not contain "--", THEN the full-line comment
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
997 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
998 full-line comment.
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
999
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1000 Indenting the following code: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1001
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1002 sig_c <= sig_d; -- comment 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1003 -- comment 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1004 -- comment 2
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1005 --debug_code:
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1006 --PROCESS(debug_in)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1007 --BEGIN
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1008 -- FOR i IN 15 DOWNTO 0 LOOP
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1009 -- debug_out(8*i+7 DOWNTO 8*i) <= debug_in(15-i);
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1010 -- END LOOP;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1011 --END PROCESS debug_code;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1012
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1013 -- comment 3
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1014 sig_e <= sig_f; -- comment 4
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1015 -- comment 5
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1016
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1017 results in: >
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1018
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1019 sig_c <= sig_d; -- comment 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1020 -- comment 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1021 -- comment 2
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1022 --debug_code:
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1023 --PROCESS(debug_in)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1024 --BEGIN
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1025 -- FOR i IN 15 DOWNTO 0 LOOP
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1026 -- debug_out(8*i+7 DOWNTO 8*i) <= debug_in(15-i);
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1027 -- END LOOP;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1028 --END PROCESS debug_code;
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1029
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1030 -- comment 3
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1031 sig_e <= sig_f; -- comment 4
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1032 -- comment 5
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1033
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1034 Notice that "--debug_code:" does not align with "-- comment 2"
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1035 because there is no whitespace that follows after "--" in "--debug_code:".
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1036
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1037 Given the dynamic nature of indenting comments, indenting should be done TWICE.
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1038 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
1039 comments will be indented according to the correctly indented code.
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1040
73fe8baea242 updated for version 7.2a
vimboss
parents: 1247
diff changeset
1041
501
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 236
diff changeset
1042 VIM *ft-vim-indent*
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
1043
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
1044 For indenting Vim scripts there is one variable that specifies the amount of
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
1045 indent for a continuation line, a line that starts with a backslash: >
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
1046
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
1047 :let g:vim_indent_cont = &sw * 3
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
1048
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
1049 Three times shiftwidth is the default value.
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
1050
cc049b00ee70 updated for version 7.0014
vimboss
parents: 15
diff changeset
1051
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1052 vim:tw=78:ts=8:ft=help:norl: