Skip to content

Commit 1116782

Browse files
committed
Update javascript.vim
1 parent 8547784 commit 1116782

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

indent/javascript.vim

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,15 @@ function GetJavascriptIndent()
397397
end
398398
" If previous line starts with a operator...
399399
elseif s:Match(prevline, s:operator_first) && !s:Match(prevline, s:comma_last)
400-
let countscur = s:LineHasOpeningBrackets(v:lnum)
401-
if countscur[0] != '2'
400+
let counts = s:LineHasOpeningBrackets(prevline)
401+
if counts[0] == '2' && counts[1] == '1'
402+
call cursor(prevline, 1)
403+
" Search for the opening tag
404+
let mnum = searchpair('(', '', ')', 'bW', s:skip_expr)
405+
if mnum > 0 && !s:Match(mnum, s:operator_first)
406+
return indent(mnum) + s:sw()
407+
end
408+
elseif counts[0] != '1' && counts[1] != '1' && counts[2] != '1'
402409
return indent(prevline) - s:sw()
403410
end
404411
end

0 commit comments

Comments
 (0)