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