37
37
endfunction
38
38
endif
39
39
40
- let s: line_pre = ' ^\s*\%(\/\*.* \*\/\s*\)*'
40
+ let s: line_pre = ' ^\s*\%(\/\*.\{-} \*\/\s*\)*'
41
41
let s: expr_case = s: line_pre . ' \%(\%(case\>.*\)\|default\)\s*:'
42
42
" Regex of syntax group names that are or delimit string or are comments.
43
- let s: syng_strcom = ' \%(s\%(tring\|pecial\)\|regex\|doc\|comment \|template\)'
43
+ let s: syng_strcom = ' \%(s\%(tring\|pecial\)\|comment\|regex\|doc \|template\)'
44
44
45
45
" Regex of syntax group names that are strings or documentation.
46
46
let s: syng_comment = ' \%(comment\|doc\)'
@@ -56,7 +56,7 @@ function s:lookForParens(start,end,flags,time)
56
56
endtry
57
57
endfunction
58
58
59
- let s: line_term = ' \s*\%(\/\*.* \*\/\s*\)*$'
59
+ let s: line_term = ' \s*\%(\/\*.\{-} \*\/\s*\)*$'
60
60
61
61
" configurable regexes that define continuation lines, not including (, {, or [.
62
62
if ! exists (' g:javascript_opfirst' )
@@ -74,7 +74,8 @@ function s:Onescope(lnum,text,add)
74
74
\ ((a: add && a: text = ~ s: line_pre . s: line_term && search (' \%' . s: PrevCodeLine (a: lnum - 1 ) . ' l.)' . s: line_term )) ||
75
75
\ cursor (a: lnum , match (a: text , ' )' . s: line_term )) > -1 ) &&
76
76
\ s: lookForParens (' (' , ' )' , ' cbW' , 100 ) > 0 && search ((a: add ?
77
- \ ' \%(function\*\|[[:lower:][:upper:]_$][[:digit:][:lower:][:upper:]_$]*\)' : ' \<\%(for\%(\s+each\)\=\|if\|let\|w\%(hile\|ith\)\)' ) . ' \_s*\%#\C' ,' bW' ) &&
77
+ \ ' \%(function\*\|[[:lower:][:upper:]_$][[:digit:][:lower:][:upper:]_$]*\)' :
78
+ \ ' \<\%(for\%(\s+each\)\=\|if\|let\|w\%(hile\|ith\)\)' ) . ' \_s*\%#\C' ,' bW' ) &&
78
79
\ (a: add || (expand (" <cword>" ) == # ' while' ? ! s: lookForParens (' \<do\>\C' , ' \<while\>\C' ,' bW' ,100 ) : 1 ))
79
80
endfunction
80
81
@@ -192,7 +193,7 @@ function GetJavascriptIndent()
192
193
if ((line = ~# g: javascript_opfirst ||
193
194
\ (pline = ~# g: javascript_continuation && pline !~# s: expr_case &&
194
195
\ (pline !~ ' :' . s: line_term || line !~#
195
- \ s: line_pre . ' \%(d\%(ebugger\|o \)\|else\|f\%(inally\|or \)\|if\|let\|switch\|t\%(hrow\|ry\)\|w\%(hile\|ith\)\)\>' ))) &&
196
+ \ s: line_pre . ' \%(d\%(o\|ebugger \)\|else\|f\%(or\|inally \)\|if\|let\|switch\|t\%(hrow\|ry\)\|w\%(hile\|ith\)\)\>' ))) &&
196
197
\ inb) || (s: Onescope (lnum,pline,0 ) && line !~ s: line_pre . ' {' )
197
198
return (num > 0 ? indent (num) : - s: sw ()) + (s: sw () * 2 ) + switch_offset
198
199
elseif num > 0
0 commit comments