Mercurial > vim
annotate runtime/indent/r.vim @ 28938:ddbb36c1830b v8.2.4991
patch 8.2.4991: no test for hwat patch 8.1.0535 fixes
Commit: https://github.com/vim/vim/commit/93c1573dd284dc9cf5ed9265a0143aaf520d2920
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat May 21 16:34:38 2022 +0100
patch 8.2.4991: no test for hwat patch 8.1.0535 fixes
Problem: No test for hwat patch 8.1.0535 fixes.
Solution: Add a test. (closes https://github.com/vim/vim/issues/10462)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 21 May 2022 17:45:03 +0200 |
parents | 0ecb909e3249 |
children | b2412874362f |
rev | line source |
---|---|
3082 | 1 " Vim indent file |
2 " Language: R | |
3 " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> | |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
4 " Homepage: https://github.com/jalvesaq/R-Vim-runtime |
14637 | 5 " Last Change: Sun Aug 19, 2018 09:13PM |
3082 | 6 |
7 | |
8 " Only load this indent file when no other was loaded. | |
4159 | 9 if exists("b:did_indent") |
6840 | 10 finish |
3082 | 11 endif |
4159 | 12 let b:did_indent = 1 |
3082 | 13 |
14 setlocal indentkeys=0{,0},:,!^F,o,O,e | |
15 setlocal indentexpr=GetRIndent() | |
16 | |
17 " Only define the function once. | |
18 if exists("*GetRIndent") | |
6840 | 19 finish |
3082 | 20 endif |
21 | |
14637 | 22 let s:cpo_save = &cpo |
23 set cpo&vim | |
24 | |
3082 | 25 " Options to make the indentation more similar to Emacs/ESS: |
14637 | 26 let g:r_indent_align_args = get(g:, 'r_indent_align_args', 1) |
27 let g:r_indent_ess_comments = get(g:, 'r_indent_ess_comments', 0) | |
28 let g:r_indent_comment_column = get(g:, 'r_indent_comment_column', 40) | |
29 let g:r_indent_ess_compatible = get(g:, 'r_indent_ess_compatible', 0) | |
30 let g:r_indent_op_pattern = get(g:, 'r_indent_op_pattern', | |
31 \ '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$') | |
3082 | 32 |
33 function s:RDelete_quotes(line) | |
6840 | 34 let i = 0 |
35 let j = 0 | |
36 let line1 = "" | |
37 let llen = strlen(a:line) | |
38 while i < llen | |
39 if a:line[i] == '"' | |
40 let i += 1 | |
41 let line1 = line1 . 's' | |
42 while !(a:line[i] == '"' && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen | |
43 let i += 1 | |
44 endwhile | |
45 if a:line[i] == '"' | |
46 let i += 1 | |
47 endif | |
48 else | |
49 if a:line[i] == "'" | |
50 let i += 1 | |
51 let line1 = line1 . 's' | |
52 while !(a:line[i] == "'" && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen | |
53 let i += 1 | |
54 endwhile | |
55 if a:line[i] == "'" | |
56 let i += 1 | |
57 endif | |
58 else | |
59 if a:line[i] == "`" | |
60 let i += 1 | |
61 let line1 = line1 . 's' | |
62 while a:line[i] != "`" && i < llen | |
3082 | 63 let i += 1 |
6840 | 64 endwhile |
65 if a:line[i] == "`" | |
66 let i += 1 | |
67 endif | |
3082 | 68 endif |
6840 | 69 endif |
70 endif | |
71 if i == llen | |
72 break | |
73 endif | |
74 let line1 = line1 . a:line[i] | |
75 let j += 1 | |
76 let i += 1 | |
77 endwhile | |
78 return line1 | |
3082 | 79 endfunction |
80 | |
81 " Convert foo(bar()) int foo() | |
82 function s:RDelete_parens(line) | |
6840 | 83 if s:Get_paren_balance(a:line, "(", ")") != 0 |
84 return a:line | |
85 endif | |
86 let i = 0 | |
87 let j = 0 | |
88 let line1 = "" | |
89 let llen = strlen(a:line) | |
90 while i < llen | |
91 let line1 = line1 . a:line[i] | |
92 if a:line[i] == '(' | |
93 let nop = 1 | |
94 while nop > 0 && i < llen | |
95 let i += 1 | |
96 if a:line[i] == ')' | |
97 let nop -= 1 | |
98 else | |
99 if a:line[i] == '(' | |
100 let nop += 1 | |
101 endif | |
102 endif | |
103 endwhile | |
104 let line1 = line1 . a:line[i] | |
3082 | 105 endif |
6840 | 106 let i += 1 |
107 endwhile | |
108 return line1 | |
3082 | 109 endfunction |
110 | |
111 function! s:Get_paren_balance(line, o, c) | |
6840 | 112 let line2 = substitute(a:line, a:o, "", "g") |
113 let openp = strlen(a:line) - strlen(line2) | |
114 let line3 = substitute(line2, a:c, "", "g") | |
115 let closep = strlen(line2) - strlen(line3) | |
116 return openp - closep | |
3082 | 117 endfunction |
118 | |
119 function! s:Get_matching_brace(linenr, o, c, delbrace) | |
6840 | 120 let line = SanitizeRLine(getline(a:linenr)) |
121 if a:delbrace == 1 | |
122 let line = substitute(line, '{$', "", "") | |
123 endif | |
124 let pb = s:Get_paren_balance(line, a:o, a:c) | |
125 let i = a:linenr | |
126 while pb != 0 && i > 1 | |
127 let i -= 1 | |
128 let pb += s:Get_paren_balance(SanitizeRLine(getline(i)), a:o, a:c) | |
129 endwhile | |
130 return i | |
3082 | 131 endfunction |
132 | |
133 " This function is buggy because there 'if's without 'else' | |
134 " It must be rewritten relying more on indentation | |
135 function! s:Get_matching_if(linenr, delif) | |
6840 | 136 let line = SanitizeRLine(getline(a:linenr)) |
137 if a:delif | |
138 let line = substitute(line, "if", "", "g") | |
139 endif | |
140 let elsenr = 0 | |
141 let i = a:linenr | |
142 let ifhere = 0 | |
143 while i > 0 | |
144 let line2 = substitute(line, '\<else\>', "xxx", "g") | |
145 let elsenr += strlen(line) - strlen(line2) | |
146 if line =~ '.*\s*if\s*()' || line =~ '.*\s*if\s*()' | |
147 let elsenr -= 1 | |
148 if elsenr == 0 | |
149 let ifhere = i | |
150 break | |
151 endif | |
3082 | 152 endif |
6840 | 153 let i -= 1 |
154 let line = SanitizeRLine(getline(i)) | |
155 endwhile | |
156 if ifhere | |
157 return ifhere | |
158 else | |
159 return a:linenr | |
160 endif | |
3082 | 161 endfunction |
162 | |
163 function! s:Get_last_paren_idx(line, o, c, pb) | |
6840 | 164 let blc = a:pb |
165 let line = substitute(a:line, '\t', s:curtabstop, "g") | |
166 let theidx = -1 | |
167 let llen = strlen(line) | |
168 let idx = 0 | |
169 while idx < llen | |
170 if line[idx] == a:o | |
171 let blc -= 1 | |
172 if blc == 0 | |
173 let theidx = idx | |
174 endif | |
175 else | |
176 if line[idx] == a:c | |
177 let blc += 1 | |
178 endif | |
179 endif | |
180 let idx += 1 | |
181 endwhile | |
182 return theidx + 1 | |
3082 | 183 endfunction |
184 | |
185 " Get previous relevant line. Search back until getting a line that isn't | |
186 " comment or blank | |
187 function s:Get_prev_line(lineno) | |
6840 | 188 let lnum = a:lineno - 1 |
189 let data = getline( lnum ) | |
190 while lnum > 0 && (data =~ '^\s*#' || data =~ '^\s*$') | |
191 let lnum = lnum - 1 | |
3082 | 192 let data = getline( lnum ) |
6840 | 193 endwhile |
194 return lnum | |
3082 | 195 endfunction |
196 | |
197 " This function is also used by r-plugin/common_global.vim | |
198 " Delete from '#' to the end of the line, unless the '#' is inside a string. | |
199 function SanitizeRLine(line) | |
6840 | 200 let newline = s:RDelete_quotes(a:line) |
201 let newline = s:RDelete_parens(newline) | |
202 let newline = substitute(newline, '#.*', "", "") | |
203 let newline = substitute(newline, '\s*$', "", "") | |
204 if &filetype == "rhelp" && newline =~ '^\\method{.*}{.*}(.*' | |
205 let newline = substitute(newline, '^\\method{\(.*\)}{.*}', '\1', "") | |
206 endif | |
207 return newline | |
3082 | 208 endfunction |
209 | |
210 function GetRIndent() | |
211 | |
6840 | 212 let clnum = line(".") " current line |
3082 | 213 |
6840 | 214 let cline = getline(clnum) |
215 if cline =~ '^\s*#' | |
216 if g:r_indent_ess_comments == 1 | |
217 if cline =~ '^\s*###' | |
218 return 0 | |
219 endif | |
220 if cline !~ '^\s*##' | |
221 return g:r_indent_comment_column | |
222 endif | |
3082 | 223 endif |
6840 | 224 endif |
3082 | 225 |
6840 | 226 let cline = SanitizeRLine(cline) |
3082 | 227 |
14637 | 228 if cline =~ '^\s*}' |
6840 | 229 let indline = s:Get_matching_brace(clnum, '{', '}', 1) |
230 if indline > 0 && indline != clnum | |
231 let iline = SanitizeRLine(getline(indline)) | |
232 if s:Get_paren_balance(iline, "(", ")") == 0 || iline =~ '(\s*{$' | |
233 return indent(indline) | |
234 else | |
235 let indline = s:Get_matching_brace(indline, '(', ')', 1) | |
236 return indent(indline) | |
237 endif | |
3082 | 238 endif |
6840 | 239 endif |
3082 | 240 |
14637 | 241 if cline =~ '^\s*)$' |
242 let indline = s:Get_matching_brace(clnum, '(', ')', 1) | |
243 return indent(indline) | |
244 endif | |
245 | |
6840 | 246 " Find the first non blank line above the current line |
247 let lnum = s:Get_prev_line(clnum) | |
248 " Hit the start of the file, use zero indent. | |
249 if lnum == 0 | |
250 return 0 | |
251 endif | |
3082 | 252 |
6840 | 253 let line = SanitizeRLine(getline(lnum)) |
3082 | 254 |
6840 | 255 if &filetype == "rhelp" |
256 if cline =~ '^\\dontshow{' || cline =~ '^\\dontrun{' || cline =~ '^\\donttest{' || cline =~ '^\\testonly{' | |
257 return 0 | |
3082 | 258 endif |
6840 | 259 if line =~ '^\\examples{' || line =~ '^\\usage{' || line =~ '^\\dontshow{' || line =~ '^\\dontrun{' || line =~ '^\\donttest{' || line =~ '^\\testonly{' |
260 return 0 | |
261 endif | |
262 endif | |
263 | |
264 if &filetype == "rnoweb" && line =~ "^<<.*>>=" | |
265 return 0 | |
266 endif | |
3082 | 267 |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
268 if cline =~ '^\s*{' && s:Get_paren_balance(cline, '{', '}') > 0 |
6840 | 269 if g:r_indent_ess_compatible && line =~ ')$' |
270 let nlnum = lnum | |
271 let nline = line | |
272 while s:Get_paren_balance(nline, '(', ')') < 0 | |
273 let nlnum = s:Get_prev_line(nlnum) | |
274 let nline = SanitizeRLine(getline(nlnum)) . nline | |
275 endwhile | |
11347 | 276 if nline =~ '^\s*function\s*(' && indent(nlnum) == shiftwidth() |
6840 | 277 return 0 |
278 endif | |
279 endif | |
280 if s:Get_paren_balance(line, "(", ")") == 0 | |
281 return indent(lnum) | |
3082 | 282 endif |
6840 | 283 endif |
3082 | 284 |
6840 | 285 " line is an incomplete command: |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
286 if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$' || line =~ '->$' |
11347 | 287 return indent(lnum) + shiftwidth() |
6840 | 288 endif |
289 | |
290 " Deal with () and [] | |
3082 | 291 |
6840 | 292 let pb = s:Get_paren_balance(line, '(', ')') |
293 | |
294 if line =~ '^\s*{$' || line =~ '(\s*{' || (pb == 0 && (line =~ '{$' || line =~ '(\s*{$')) | |
11347 | 295 return indent(lnum) + shiftwidth() |
6840 | 296 endif |
3082 | 297 |
6840 | 298 let s:curtabstop = repeat(' ', &tabstop) |
3082 | 299 |
6840 | 300 if g:r_indent_align_args == 1 |
301 if pb > 0 && line =~ '{$' | |
11347 | 302 return s:Get_last_paren_idx(line, '(', ')', pb) + shiftwidth() |
3082 | 303 endif |
304 | |
305 let bb = s:Get_paren_balance(line, '[', ']') | |
306 | |
6840 | 307 if pb > 0 |
308 if &filetype == "rhelp" | |
309 let ind = s:Get_last_paren_idx(line, '(', ')', pb) | |
310 else | |
311 let ind = s:Get_last_paren_idx(getline(lnum), '(', ')', pb) | |
312 endif | |
313 return ind | |
314 endif | |
3082 | 315 |
6840 | 316 if pb < 0 && line =~ '.*[,&|\-\*+<>]$' |
317 let lnum = s:Get_prev_line(lnum) | |
318 while pb < 1 && lnum > 0 | |
319 let line = SanitizeRLine(getline(lnum)) | |
320 let line = substitute(line, '\t', s:curtabstop, "g") | |
321 let ind = strlen(line) | |
322 while ind > 0 | |
323 if line[ind] == ')' | |
324 let pb -= 1 | |
325 else | |
326 if line[ind] == '(' | |
327 let pb += 1 | |
328 endif | |
329 endif | |
330 if pb == 1 | |
331 return ind + 1 | |
332 endif | |
333 let ind -= 1 | |
334 endwhile | |
335 let lnum -= 1 | |
336 endwhile | |
337 return 0 | |
3082 | 338 endif |
339 | |
6840 | 340 if bb > 0 |
341 let ind = s:Get_last_paren_idx(getline(lnum), '[', ']', bb) | |
342 return ind | |
3082 | 343 endif |
6840 | 344 endif |
345 | |
346 let post_block = 0 | |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
347 if line =~ '}$' && s:Get_paren_balance(line, '{', '}') < 0 |
6840 | 348 let lnum = s:Get_matching_brace(lnum, '{', '}', 0) |
349 let line = SanitizeRLine(getline(lnum)) | |
350 if lnum > 0 && line =~ '^\s*{' | |
351 let lnum = s:Get_prev_line(lnum) | |
352 let line = SanitizeRLine(getline(lnum)) | |
353 endif | |
354 let pb = s:Get_paren_balance(line, '(', ')') | |
355 let post_block = 1 | |
356 endif | |
3082 | 357 |
6840 | 358 " Indent after operator pattern |
359 let olnum = s:Get_prev_line(lnum) | |
360 let oline = getline(olnum) | |
361 if olnum > 0 | |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
362 if line =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 |
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
363 if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 |
6840 | 364 return indent(lnum) |
365 else | |
11347 | 366 return indent(lnum) + shiftwidth() |
6840 | 367 endif |
368 else | |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
369 if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 |
11347 | 370 return indent(lnum) - shiftwidth() |
6840 | 371 endif |
372 endif | |
373 endif | |
3082 | 374 |
6840 | 375 let post_fun = 0 |
376 if pb < 0 && line !~ ')\s*[,&|\-\*+<>]$' | |
377 let post_fun = 1 | |
378 while pb < 0 && lnum > 0 | |
379 let lnum -= 1 | |
380 let linepiece = SanitizeRLine(getline(lnum)) | |
381 let pb += s:Get_paren_balance(linepiece, "(", ")") | |
382 let line = linepiece . line | |
383 endwhile | |
384 if line =~ '{$' && post_block == 0 | |
11347 | 385 return indent(lnum) + shiftwidth() |
3082 | 386 endif |
387 | |
6840 | 388 " Now we can do some tests again |
389 if cline =~ '^\s*{' | |
390 return indent(lnum) | |
391 endif | |
392 if post_block == 0 | |
393 let newl = SanitizeRLine(line) | |
394 if newl =~ '\<\(if\|while\|for\|function\)\s*()$' || newl =~ '\<else$' || newl =~ '<-$' | |
11347 | 395 return indent(lnum) + shiftwidth() |
6840 | 396 endif |
397 endif | |
398 endif | |
399 | |
400 if cline =~ '^\s*else' | |
401 if line =~ '<-\s*if\s*()' | |
11347 | 402 return indent(lnum) + shiftwidth() |
6840 | 403 else |
404 if line =~ '\<if\s*()' | |
405 return indent(lnum) | |
406 else | |
11347 | 407 return indent(lnum) - shiftwidth() |
6840 | 408 endif |
409 endif | |
410 endif | |
411 | |
412 let bb = s:Get_paren_balance(line, '[', ']') | |
413 if bb < 0 && line =~ '.*]' | |
414 while bb < 0 && lnum > 0 | |
415 let lnum -= 1 | |
416 let linepiece = SanitizeRLine(getline(lnum)) | |
417 let bb += s:Get_paren_balance(linepiece, "[", "]") | |
418 let line = linepiece . line | |
419 endwhile | |
420 let line = s:RDelete_parens(line) | |
421 endif | |
422 | |
423 let plnum = s:Get_prev_line(lnum) | |
424 let ppost_else = 0 | |
425 if plnum > 0 | |
426 let pline = SanitizeRLine(getline(plnum)) | |
427 let ppost_block = 0 | |
428 if pline =~ '}$' | |
429 let ppost_block = 1 | |
430 let plnum = s:Get_matching_brace(plnum, '{', '}', 0) | |
431 let pline = SanitizeRLine(getline(plnum)) | |
432 if pline =~ '^\s*{$' && plnum > 0 | |
433 let plnum = s:Get_prev_line(plnum) | |
434 let pline = SanitizeRLine(getline(plnum)) | |
435 endif | |
436 endif | |
437 | |
438 if pline =~ 'else$' | |
439 let ppost_else = 1 | |
440 let plnum = s:Get_matching_if(plnum, 0) | |
441 let pline = SanitizeRLine(getline(plnum)) | |
3082 | 442 endif |
443 | |
6840 | 444 if pline =~ '^\s*else\s*if\s*(' |
445 let pplnum = s:Get_prev_line(plnum) | |
446 let ppline = SanitizeRLine(getline(pplnum)) | |
447 while ppline =~ '^\s*else\s*if\s*(' || ppline =~ '^\s*if\s*()\s*\S$' | |
448 let plnum = pplnum | |
449 let pline = ppline | |
450 let pplnum = s:Get_prev_line(plnum) | |
451 let ppline = SanitizeRLine(getline(pplnum)) | |
452 endwhile | |
453 while ppline =~ '\<\(if\|while\|for\|function\)\s*()$' || ppline =~ '\<else$' || ppline =~ '<-$' | |
454 let plnum = pplnum | |
455 let pline = ppline | |
456 let pplnum = s:Get_prev_line(plnum) | |
457 let ppline = SanitizeRLine(getline(pplnum)) | |
458 endwhile | |
3082 | 459 endif |
460 | |
6840 | 461 let ppb = s:Get_paren_balance(pline, '(', ')') |
462 if ppb < 0 && (pline =~ ')\s*{$' || pline =~ ')$') | |
463 while ppb < 0 && plnum > 0 | |
464 let plnum -= 1 | |
465 let linepiece = SanitizeRLine(getline(plnum)) | |
466 let ppb += s:Get_paren_balance(linepiece, "(", ")") | |
467 let pline = linepiece . pline | |
468 endwhile | |
469 let pline = s:RDelete_parens(pline) | |
3082 | 470 endif |
6840 | 471 endif |
3082 | 472 |
6840 | 473 let ind = indent(lnum) |
3153 | 474 |
6840 | 475 if g:r_indent_align_args == 0 && pb != 0 |
11347 | 476 let ind += pb * shiftwidth() |
6840 | 477 return ind |
478 endif | |
3082 | 479 |
6840 | 480 if g:r_indent_align_args == 0 && bb != 0 |
11347 | 481 let ind += bb * shiftwidth() |
6840 | 482 return ind |
483 endif | |
3153 | 484 |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
485 if plnum > 0 |
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
486 let pind = indent(plnum) |
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
487 else |
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
488 let pind = 0 |
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
489 endif |
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
490 |
11347 | 491 if ind == pind || (ind == (pind + shiftwidth()) && pline =~ '{$' && ppost_else == 0) |
6840 | 492 return ind |
493 endif | |
494 | |
495 let pline = getline(plnum) | |
496 let pbb = s:Get_paren_balance(pline, '[', ']') | |
497 | |
498 while pind < ind && plnum > 0 && ppb == 0 && pbb == 0 | |
499 let ind = pind | |
500 let plnum = s:Get_prev_line(plnum) | |
501 let pline = getline(plnum) | |
502 let ppb = s:Get_paren_balance(pline, '(', ')') | |
503 let pbb = s:Get_paren_balance(pline, '[', ']') | |
504 while pline =~ '^\s*else' | |
505 let plnum = s:Get_matching_if(plnum, 1) | |
506 let pline = getline(plnum) | |
507 let ppb = s:Get_paren_balance(pline, '(', ')') | |
508 let pbb = s:Get_paren_balance(pline, '[', ']') | |
3082 | 509 endwhile |
6840 | 510 let pind = indent(plnum) |
11347 | 511 if ind == (pind + shiftwidth()) && pline =~ '{$' |
6840 | 512 return ind |
513 endif | |
514 endwhile | |
3082 | 515 |
6840 | 516 return ind |
3082 | 517 endfunction |
518 | |
14637 | 519 let &cpo = s:cpo_save |
520 unlet s:cpo_save | |
521 | |
6840 | 522 " vim: sw=2 |