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