Mercurial > vim
annotate runtime/indent/mp.vim @ 30210:1ab4a87efc91
Added tag v9.0.0440 for changeset a970b48c25a34cd148e948d71ebdc6d9a1de5683
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 11 Sep 2022 13:00:08 +0200 |
parents | f00c56ee8118 |
children |
rev | line source |
---|---|
29885 | 1 vim9script |
2 | |
3 # MetaPost indent file | |
4 # Language: MetaPost | |
5 # Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> | |
6 # Former Maintainers: Eugene Minkovskii <emin@mccme.ru> | |
7 # Latest Revision: 2022 Aug 12 | |
7 | 8 |
9 if exists("b:did_indent") | |
10 finish | |
11 endif | |
12 | |
29885 | 13 b:did_indent = 1 |
7 | 14 |
29885 | 15 setlocal indentexpr=g:MetaPostIndent() |
16 setlocal indentkeys+==end,=else,=fi,=fill,0),0] | |
17 setlocal nolisp | |
18 setlocal nosmartindent | |
19 | |
20 b:undo_indent = "setl indentexpr< indentkeys< lisp< smartindent<" | |
7 | 21 |
29885 | 22 # Regexps {{{ |
23 # Expressions starting indented blocks | |
24 const MP_OPEN_TAG = [ | |
25 '\<if\>', | |
26 '\<else\%[if]\>', | |
27 '\<for\%(\|ever\|suffixes\)\>', | |
28 '\<begingroup\>', | |
29 '\<\%(\|var\|primary\|secondary\|tertiary\)def\>', | |
30 '^\s*\<begin\%(fig\|graph\|glyph\|char\|logochar\)\>', | |
31 '[([{]', | |
32 ]->extend(get(g:, "mp_open_tag", []))->join('\|') | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
33 |
29885 | 34 # Expressions ending indented blocks |
35 const MP_CLOSE_TAG = [ | |
36 '\<fi\>', | |
37 '\<else\%[if]\>', | |
38 '\<end\%(\|for\|group\|def\|fig\|char\|glyph\|graph\)\>', | |
39 '[)\]}]' | |
40 ]->extend(get(g:, "mp_close_tag", []))->join('\|') | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
41 |
29885 | 42 # Statements that may span multiple lines and are ended by a semicolon. To |
43 # keep this list short, statements that are unlikely to be very long or are | |
44 # not very common (e.g., keywords like `interim` or `showtoken`) are not | |
45 # included. | |
46 # | |
47 # The regex for assignments and equations (the last branch) is tricky, because | |
48 # it must not match things like `for i :=`, `if a=b`, `def...=`, etc... It is | |
49 # not perfect, but it works reasonably well. | |
50 const MP_STATEMENT = [ | |
51 '\<\%(\|un\|cut\)draw\%(dot\)\=\>', | |
52 '\<\%(\|un\)fill\%[draw]\>', | |
53 '\<draw\%(dbl\)\=arrow\>', | |
54 '\<clip\>', | |
55 '\<addto\>', | |
56 '\<save\>', | |
57 '\<setbounds\>', | |
58 '\<message\>', | |
59 '\<errmessage\>', | |
60 '\<errhelp\>', | |
61 '\<fontmapline\>', | |
62 '\<pickup\>', | |
63 '\<show\>', | |
64 '\<special\>', | |
65 '\<write\>', | |
66 '\%(^\|;\)\%([^;=]*\%(' .. MP_OPEN_TAG .. '\)\)\@!.\{-}:\==', | |
67 ]->join('\|') | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
68 |
29885 | 69 # A line ends with zero or more spaces, possibly followed by a comment. |
70 const EOL = '\s*\%($\|%\)' | |
71 # }}} | |
72 | |
73 # Auxiliary functions {{{ | |
74 # Returns true if (0-based) position immediately preceding `pos` in `line` is | |
75 # inside a string or a comment; returns false otherwise. | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
76 |
29885 | 77 # This is the function that is called more often when indenting, so it is |
78 # critical that it is efficient. The method we use is significantly faster | |
79 # than using syntax attributes, and more general (it does not require | |
80 # syntax_items). It is also faster than using a single regex matching an even | |
81 # number of quotes. It helps that MetaPost strings cannot span more than one | |
82 # line and cannot contain escaped quotes. | |
83 def IsCommentOrString(line: string, pos: number): bool | |
84 var in_string = 0 | |
85 var q = stridx(line, '"') | |
86 var c = stridx(line, '%') | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
87 |
29885 | 88 while q >= 0 && q < pos |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
89 if c >= 0 && c < q |
29885 | 90 if in_string # Find next percent symbol |
91 c = stridx(line, '%', q + 1) | |
92 else # Inside comment | |
93 return true | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
94 endif |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
95 endif |
29885 | 96 in_string = 1 - in_string |
97 q = stridx(line, '"', q + 1) # Find next quote | |
7 | 98 endwhile |
29885 | 99 |
100 return in_string || (c >= 0 && c <= pos) | |
101 enddef | |
7 | 102 |
29885 | 103 # Find the first non-comment non-blank line before the given line. |
104 def PrevNonBlankNonComment(lnum: number): number | |
105 var nr = prevnonblank(lnum - 1) | |
106 while getline(nr) =~# '^\s*%' | |
107 nr = prevnonblank(nr - 1) | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
108 endwhile |
29885 | 109 return nr |
110 enddef | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
111 |
29885 | 112 # Returns true if the last tag appearing in the line is an open tag; returns |
113 # false otherwise. | |
114 def LastTagIsOpen(line: string): bool | |
115 var o = LastValidMatchEnd(line, MP_OPEN_TAG, 0) | |
116 if o == - 1 | |
117 return false | |
118 endif | |
119 return LastValidMatchEnd(line, MP_CLOSE_TAG, o) < 0 | |
120 enddef | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
121 |
29885 | 122 # A simple, efficient and quite effective heuristics is used to test whether |
123 # a line should cause the next line to be indented: count the "opening tags" | |
124 # (if, for, def, ...) in the line, count the "closing tags" (endif, endfor, | |
125 # ...) in the line, and compute the difference. We call the result the | |
126 # "weight" of the line. If the weight is positive, then the next line should | |
127 # most likely be indented. Note that `else` and `elseif` are both opening and | |
128 # closing tags, so they "cancel out" in almost all cases, the only exception | |
129 # being a leading `else[if]`, which is counted as an opening tag, but not as | |
130 # a closing tag (so that, for instance, a line containing a single `else:` | |
131 # will have weight equal to one, not zero). We do not treat a trailing | |
132 # `else[if]` in any special way, because lines ending with an open tag are | |
133 # dealt with separately before this function is called (see MetaPostIndent()). | |
134 # | |
135 # Example: | |
136 # | |
137 # forsuffixes $=a,b: if x.$ = y.$ : draw else: fill fi | |
138 # % This line will be indented because |{forsuffixes,if,else}| > |{else,fi}| (3 > 2) | |
139 # endfor | |
140 def Weight(line: string): number | |
141 var o = 0 | |
142 var i = ValidMatchEnd(line, MP_OPEN_TAG, 0) | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
143 while i > 0 |
29885 | 144 o += 1 |
145 i = ValidMatchEnd(line, MP_OPEN_TAG, i) | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
146 endwhile |
29885 | 147 var c = 0 |
148 i = matchend(line, '^\s*\<else\%[if]\>') # Skip a leading else[if] | |
149 i = ValidMatchEnd(line, MP_CLOSE_TAG, i) | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
150 while i > 0 |
29885 | 151 c += 1 |
152 i = ValidMatchEnd(line, MP_CLOSE_TAG, i) | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
153 endwhile |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
154 return o - c |
29885 | 155 enddef |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
156 |
29885 | 157 # Similar to matchend(), but skips strings and comments. |
158 # line: a String | |
159 def ValidMatchEnd(line: string, pat: string, start: number): number | |
160 var i = matchend(line, pat, start) | |
161 while i > 0 && IsCommentOrString(line, i) | |
162 i = matchend(line, pat, i) | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
163 endwhile |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
164 return i |
29885 | 165 enddef |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
166 |
29885 | 167 # Like s:ValidMatchEnd(), but returns the end position of the last (i.e., |
168 # rightmost) match. | |
169 def LastValidMatchEnd(line: string, pat: string, start: number): number | |
170 var last_found = -1 | |
171 var i = matchend(line, pat, start) | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
172 while i > 0 |
29885 | 173 if !IsCommentOrString(line, i) |
174 last_found = i | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
175 endif |
29885 | 176 i = matchend(line, pat, i) |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
177 endwhile |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
178 return last_found |
29885 | 179 enddef |
7 | 180 |
29885 | 181 def DecreaseIndentOnClosingTag(curr_indent: number): number |
182 var cur_text = getline(v:lnum) | |
183 if cur_text =~# '^\s*\%(' .. MP_CLOSE_TAG .. '\)' | |
184 return max([curr_indent - shiftwidth(), 0]) | |
185 endif | |
186 return curr_indent | |
187 enddef | |
188 # }}} | |
189 | |
190 # Main function {{{ | |
191 def g:MetaPostIndent(): number | |
192 # Do not touch indentation inside verbatimtex/btex.. etex blocks. | |
10261
bdd7fc1a38c0
commit https://github.com/vim/vim/commit/dc08328821a2c11e33dfb1980332e4923ec64fca
Christian Brabandt <cb@256bit.org>
parents:
10244
diff
changeset
|
193 if synIDattr(synID(v:lnum, 1, 1), "name") =~# '^mpTeXinsert$\|^tex\|^Delimiter' |
bdd7fc1a38c0
commit https://github.com/vim/vim/commit/dc08328821a2c11e33dfb1980332e4923ec64fca
Christian Brabandt <cb@256bit.org>
parents:
10244
diff
changeset
|
194 return -1 |
bdd7fc1a38c0
commit https://github.com/vim/vim/commit/dc08328821a2c11e33dfb1980332e4923ec64fca
Christian Brabandt <cb@256bit.org>
parents:
10244
diff
changeset
|
195 endif |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
196 |
29885 | 197 # At the start of a MetaPost block inside ConTeXt, do not touch indentation |
198 if synIDattr(synID(prevnonblank(v:lnum - 1), 1, 1), "name") == "contextBlockDelim" | |
199 return -1 | |
200 endif | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
201 |
29885 | 202 var lnum = PrevNonBlankNonComment(v:lnum) |
203 | |
204 # At the start of the file use zero indent. | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
205 if lnum == 0 |
7 | 206 return 0 |
207 endif | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
208 |
29885 | 209 var prev_text = getline(lnum) |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
210 |
29885 | 211 # Every rule of indentation in MetaPost is very subjective. We might get |
212 # creative, but things get murky very soon (there are too many corner | |
213 # cases). So, we provide a means for the user to decide what to do when this | |
214 # script doesn't get it. We use a simple idea: use '%>', '%<', '%=', and | |
215 # '%!', to explicitly control indentation. The '<' and '>' symbols may be | |
216 # repeated many times (e.g., '%>>' will cause the next line to be indented | |
217 # twice). | |
218 # | |
219 # User-defined overrides take precedence over anything else. | |
220 var j = match(prev_text, '%[<>=!]') | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
221 if j > 0 |
29885 | 222 var i = strlen(matchstr(prev_text, '%>\+', j)) - 1 |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
223 if i > 0 |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
224 return indent(lnum) + i * shiftwidth() |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
225 endif |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
226 |
29885 | 227 i = strlen(matchstr(prev_text, '%<\+', j)) - 1 |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
228 if i > 0 |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
229 return max([indent(lnum) - i * shiftwidth(), 0]) |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
230 endif |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
231 |
29885 | 232 if match(prev_text, '%=', j) > -1 |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
233 return indent(lnum) |
7 | 234 endif |
29885 | 235 |
236 if match(prev_text, '%!', j) > -1 | |
237 return -1 | |
238 endif | |
7 | 239 endif |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
240 |
29885 | 241 # If the reference line ends with an open tag, indent. |
242 # | |
243 # Example: | |
244 # | |
245 # if c: | |
246 # 0 | |
247 # else: | |
248 # 1 | |
249 # fi if c2: % Note that this line has weight equal to zero. | |
250 # ... % This line will be indented | |
251 if LastTagIsOpen(prev_text) | |
252 return DecreaseIndentOnClosingTag(indent(lnum) + shiftwidth()) | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
253 endif |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
254 |
29885 | 255 # Lines with a positive weight are unbalanced and should likely be indented. |
256 # | |
257 # Example: | |
258 # | |
259 # def f = enddef for i = 1 upto 5: if x[i] > 0: 1 else: 2 fi | |
260 # ... % This line will be indented (because of the unterminated `for`) | |
261 if Weight(prev_text) > 0 | |
262 return DecreaseIndentOnClosingTag(indent(lnum) + shiftwidth()) | |
7 | 263 endif |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
264 |
29885 | 265 # Unterminated statements cause indentation to kick in. |
266 # | |
267 # Example: | |
268 # | |
269 # draw unitsquare | |
270 # withcolor black; % This line is indented because of `draw`. | |
271 # x := a + b + c | |
272 # + d + e; % This line is indented because of `:=`. | |
273 # | |
274 var i = LastValidMatchEnd(prev_text, MP_STATEMENT, 0) | |
275 if i >= 0 # Does the line contain a statement? | |
276 if ValidMatchEnd(prev_text, ';', i) < 0 # Is the statement unterminated? | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
277 return indent(lnum) + shiftwidth() |
7 | 278 else |
29885 | 279 return DecreaseIndentOnClosingTag(indent(lnum)) |
7 | 280 endif |
281 endif | |
282 | |
29885 | 283 # Deal with the special case of a statement spanning multiple lines. If the |
284 # current reference line L ends with a semicolon, search backwards for | |
285 # another semicolon or a statement keyword. If the latter is found first, | |
286 # its line is used as the reference line for indenting the current line | |
287 # instead of L. | |
288 # | |
289 # Example: | |
290 # | |
291 # if cond: | |
292 # draw if a: z0 else: z1 fi | |
293 # shifted S | |
294 # scaled T; % L | |
295 # | |
296 # for i = 1 upto 3: % <-- Current line: this gets the same indent as `draw ...` | |
297 # | |
298 # NOTE: we get here only if L does not contain a statement (among those | |
299 # listed in g:MP_STATEMENT). | |
300 if ValidMatchEnd(prev_text, ';' .. EOL, 0) >= 0 # L ends with a semicolon | |
301 var stm_lnum = PrevNonBlankNonComment(lnum) | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
302 while stm_lnum > 0 |
29885 | 303 prev_text = getline(stm_lnum) |
304 var sc_pos = LastValidMatchEnd(prev_text, ';', 0) | |
305 var stm_pos = ValidMatchEnd(prev_text, MP_STATEMENT, sc_pos) | |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
306 if stm_pos > sc_pos |
29885 | 307 lnum = stm_lnum |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
308 break |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
309 elseif sc_pos > stm_pos |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
310 break |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
311 endif |
29885 | 312 stm_lnum = PrevNonBlankNonComment(stm_lnum) |
10244
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
313 endwhile |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
314 endif |
876fbdd84e52
commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca
Christian Brabandt <cb@256bit.org>
parents:
3526
diff
changeset
|
315 |
29885 | 316 return DecreaseIndentOnClosingTag(indent(lnum)) |
317 enddef | |
318 # }}} | |
7 | 319 |
29885 | 320 # vim: sw=2 fdm=marker |