Skip to content

Commit 96885ca

Browse files
authored
small perf gain
1 parent 0c3a350 commit 96885ca

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

indent/javascript.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,17 @@ function GetJavascriptIndent()
166166
let num = pcounts[0] =~ '1' ? lnum : b:js_cache[1]
167167
else
168168
call cursor(v:lnum,1)
169-
let syns = synIDattr(synID(v:lnum, 1, 1), 'name')
170-
if line[1] =~ '\s'
169+
if line[0] =~ '\s'
170+
let syns = synIDattr(synID(v:lnum, 1, 1), 'name')
171171
if syns != ''
172172
let pattern = syns =~? 'funcblock' ? ['{','}'] : syns =~? 'jsparen' ? ['(',')'] : syns =~? 'jsbracket'? ['\[','\]'] :
173173
\ ['(\|{\|\[',')\|}\|\]']
174174
let num = s:lookForParens(pattern[0],pattern[1],'nbw',2000)
175175
else
176-
let num = 0
176+
let num = s:lookForParens('(\|{\|\[',')\|}\|\]','nbW',2000)
177177
end
178178
else
179-
let num = s:lookForParens('(\|{\|\[',')\|}\|\]','nbW',2000)
179+
let num = 0
180180
end
181181
end
182182
let b:js_cache = [v:lnum, num]

0 commit comments

Comments
 (0)