diff --git a/indent/javascript.vim b/indent/javascript.vim index 788d4753..e8afa805 100644 --- a/indent/javascript.vim +++ b/indent/javascript.vim @@ -70,7 +70,7 @@ let s:one_line_scope_regex = '\%(\%(\\|\<\%(if\|for\|while\)\>\s*(\%([^() " Regex that defines blocks. let s:block_regex = '\%([{([]\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term -let s:operator_first = '^\s*\%([*/.:?]\|\([-+]\)\1\@!\|||\|&&\)' +let s:operator_first = '^\s*\%([*.:?]\|\([/-+]\)\1\@!\|||\|&&\)' let s:var_stmt = '^\s*\%(const\|let\|var\)' @@ -325,6 +325,11 @@ function GetJavascriptIndent() " previous nonblank line number let prevline = prevnonblank(v:lnum - 1) + " If we are in a multi-line comment, cindent does the right thing. + if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1) + return cindent(v:lnum) + endif + if (line =~ s:expr_case) return cindent(v:lnum) endif @@ -423,11 +428,6 @@ function GetJavascriptIndent() return indent(prevline) - s:sw() endif - " If we are in a multi-line comment, cindent does the right thing. - if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1) - return cindent(v:lnum) - endif - " Check for multiple var assignments " let var_indent = s:GetVarIndent(v:lnum) " if var_indent >= 0