Skip to content

Commit d2fa176

Browse files
committed
multiline comment (#408)
* Update javascript.vim * Update javascript.vim
1 parent 304e2ac commit d2fa176

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

indent/javascript.vim

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ let s:one_line_scope_regex = '\%(\%(\<else\>\|\<\%(if\|for\|while\)\>\s*(\%([^()
7070
" Regex that defines blocks.
7171
let s:block_regex = '\%([{([]\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term
7272

73-
let s:operator_first = '^\s*\%([*/.:?]\|\([-+]\)\1\@!\|||\|&&\)'
73+
let s:operator_first = '^\s*\%([*.:?]\|\([/-+]\)\1\@!\|||\|&&\)'
7474

7575
let s:var_stmt = '^\s*\%(const\|let\|var\)'
7676

@@ -325,6 +325,11 @@ function GetJavascriptIndent()
325325
" previous nonblank line number
326326
let prevline = prevnonblank(v:lnum - 1)
327327

328+
" If we are in a multi-line comment, cindent does the right thing.
329+
if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1)
330+
return cindent(v:lnum)
331+
endif
332+
328333
if (line =~ s:expr_case)
329334
return cindent(v:lnum)
330335
endif
@@ -423,11 +428,6 @@ function GetJavascriptIndent()
423428
return indent(prevline) - s:sw()
424429
endif
425430

426-
" If we are in a multi-line comment, cindent does the right thing.
427-
if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1)
428-
return cindent(v:lnum)
429-
endif
430-
431431
" Check for multiple var assignments
432432
" let var_indent = s:GetVarIndent(v:lnum)
433433
" if var_indent >= 0

0 commit comments

Comments
 (0)