@@ -165,7 +165,7 @@ function s:Balanced(lnum)
165165 let pos = match (l: line , ' [][(){}]' , 0 )
166166 while pos != -1
167167 if synIDattr (synID (a: lnum ,pos + 1 ,0 ),' name' ) !~? s: syng_strcom
168- if l: line [pos] = ~ ' [{([] '
168+ if stridx ( ' [({ ' , l: line [pos]) + 1
169169 let l: open += 1
170170 else
171171 let l: open -= 1
@@ -215,14 +215,14 @@ function GetJavascriptIndent()
215215
216216 " the containing paren, bracket, curly. Many hacks for performance
217217 call cursor (v: lnum ,1 )
218- let idx = stridx (' ])}' ,l: line [0 ])
218+ let idx = strlen ( l: line ) ? stridx (' ])}' ,l: line [0 ]) : -1
219219 if indent (l: lnum )
220220 let [s: looksyn ,s: free ] = [v: lnum - 1 ,1 ]
221221 if b: js_cache [0 ] >= l: lnum && b: js_cache [0 ] < v: lnum &&
222222 \ (b: js_cache [0 ] > l: lnum || idx < 0 && s: Balanced (l: lnum ))
223223 let num = b: js_cache [1 ]
224224 elseif idx + 1
225- return indent (s: GetPair (escape ( ' [({ ' [idx], ' [ ' ) , ' ])}' [idx],' bW' ,' s:skip_func(s:looksyn)' ,2000 ))
225+ return indent (s: GetPair ([ ' \[ ' , ' ( ' , ' { ' ] [idx], ' ])}' [idx],' bW' ,' s:skip_func(s:looksyn)' ,2000 ))
226226 elseif indent (v: lnum ) && syns = ~? ' block'
227227 let num = s: GetPair (' {' ,' }' ,' bW' ,' s:skip_func(s:looksyn)' ,2000 )
228228 else
@@ -255,7 +255,7 @@ function GetJavascriptIndent()
255255 " most significant, find the indent amount
256256 let isOp = l: line = ~# s: opfirst || pline !~# s: expr_case . ' $' && pline = ~# s: continuation
257257 let bL = s: iscontOne (l: lnum ,num,isOp)
258- let bL -= (bL && l: line = ~ ' ^{ ' ) * s: W
258+ let bL -= (bL && strridx ( l: line, ' { ' , 0 ) + 1 ) * s: W
259259 if isOp && (! num || bchar && cursor (b: js_cache [1 ],b: js_cache [2 ])+ 1 && s: IsBlock ())
260260 return (num ? indent (num) : - s: W ) + (s: W * 2 ) + switch_offset + bL
261261 elseif num
0 commit comments