@@ -58,8 +58,16 @@ endfunc
58
58
59
59
let s: line_term = ' \s*\%(\%(:\@<!\/\/.*\)\=\|\%(\/\*.*\*\/\s*\)*\)$'
60
60
61
- " Regex that defines continuation lines, not including (, {, or [.
62
- let s: continuation_regex = ' \%([*,.?:]\|+\@<!+\|-\@<!-\|\*\@<!\/\|=\|||\|&&\)' . s: line_term
61
+ " configurable regexes that define continuation lines, not including (, {, or [.
62
+ if ! exists (' g:javascript_opfirst' )
63
+ let g: javascript_opfirst = ' \%([,:?]\|\([-/.+*]\)\%(\1\|\*\|\/\)\@!\|||\|&&\)'
64
+ endif
65
+ let g: javascript_opfirst = s: line_pre . g: javascript_opfirst
66
+
67
+ if ! exists (' g:javascript_continuation' )
68
+ let g: javascript_continuation = ' \%([*,.?:]\|+\@<!+\|-\@<!-\|\*\@<!\/\|=\|||\|&&\)'
69
+ endif
70
+ let g: javascript_continuation .= s: line_term
63
71
64
72
function s: Onescope (lnum)
65
73
return getline (a: lnum ) = ~ ' \%(\<else\|\<do\|=>\)\C' . s: line_term ||
@@ -70,8 +78,6 @@ function s:Onescope(lnum)
70
78
\ (expand (" <cword>" ) = ~ ' while\C' ? ! s: lookForParens (' \<do\>\C' , ' \<while\>\C' ,' bw' ,100 ) : 1 )
71
79
endfunction
72
80
73
- let s: operator_first = s: line_pre . ' \%([,:?]\|\([-/.+*]\)\%(\1\|\*\|\/\)\@!\|||\|&&\)'
74
-
75
81
" Auxiliary Functions {{{2
76
82
" ======================
77
83
@@ -194,8 +200,8 @@ function GetJavascriptIndent()
194
200
let num = max ([num,bnum])
195
201
let b: js_cache [1 ] = num
196
202
endif
197
- if (line = ~ s: operator_first ||
198
- \ (getline (lnum) = ~ s: continuation_regex && getline (lnum) !~ s: expr_case ) ||
203
+ if (line = ~ g: javascript_opfirst ||
204
+ \ (getline (lnum) = ~ g: javascript_continuation && getline (lnum) !~ s: expr_case ) ||
199
205
\ (s: Onescope (lnum) && line !~ s: line_pre . ' {' )) &&
200
206
\ (num != lnum &&
201
207
\ synIDattr (synID (v: lnum , 1 , 1 ), ' name' ) !~? ' jsdestructuringblock\|args\|jsbracket\|jsparen\|jsobject' )
0 commit comments