@@ -37,6 +37,9 @@ let s:syng_string = 'regex\c'
37
37
" Regex of syntax group names that are strings or documentation.
38
38
let s: syng_multiline = ' comment\c'
39
39
40
+ " Regex of syntax group names that are line comment.
41
+ let s: syng_linecom = ' linecomment\c'
42
+
40
43
" Expression used to check whether we should skip a match with searchpair().
41
44
let s: skip_expr = " synIDattr(synID(line('.'),col('.'),1),'name') =~ '" .s: syng_strcom ." '"
42
45
@@ -77,6 +80,11 @@ function s:IsInMultilineComment(lnum, col)
77
80
return synIDattr (synID (a: lnum , a: col , 1 ), ' name' ) = ~ s: syng_multiline
78
81
endfunction
79
82
83
+ " Check if the character at lnum:col is a line comment.
84
+ function s: IsLineComment (lnum, col )
85
+ return synIDattr (synID (a: lnum , a: col , 1 ), ' name' ) = ~ s: syng_linecom
86
+ endfunction
87
+
80
88
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
81
89
function s: PrevNonBlankNonString (lnum)
82
90
let in_block = 0
@@ -323,7 +331,7 @@ function GetJavascriptIndent()
323
331
endif
324
332
325
333
" If we are in a multi-line comment, cindent does the right thing.
326
- if s: IsInMultilineComment (v: lnum , 1 )
334
+ if s: IsInMultilineComment (v: lnum , 1 ) && ! s: IsLineComment ( v: lnum , 1 )
327
335
return cindent (v: lnum )
328
336
endif
329
337
0 commit comments