@@ -41,6 +41,9 @@ let s:syng_string = 'regex\c'
41
41
" Regex of syntax group names that are strings or documentation.
42
42
let s: syng_multiline = ' comment\c'
43
43
44
+ " Regex of syntax group names that are line comment.
45
+ let s: syng_linecom = ' linecomment'
46
+
44
47
" Expression used to check whether we should skip a match with searchpair().
45
48
let s: skip_expr = " synIDattr(synID(line('.'),col('.'),1),'name') =~ '" .s: syng_strcom ." '"
46
49
@@ -76,6 +79,11 @@ function s:IsInMultilineComment(lnum, col)
76
79
return synIDattr (synID (a: lnum , a: col , 1 ), ' name' ) = ~ s: syng_multiline
77
80
endfunction
78
81
82
+ " Check if the character at lnum:col is a line comment.
83
+ function s: IsLineComment (lnum, col )
84
+ return synIDattr (synID (a: lnum , a: col , 1 ), ' name' ) = ~ s: syng_linecom
85
+ endfunction
86
+
79
87
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
80
88
function s: PrevNonBlankNonString (lnum)
81
89
let in_block = 0
@@ -244,7 +252,7 @@ function GetJavascriptIndent()
244
252
endif
245
253
246
254
" If we are in a multi-line comment, cindent does the right thing.
247
- if s: IsInMultilineComment (v: lnum , 1 )
255
+ if s: IsInMultilineComment (v: lnum , 1 ) && ! s: IsLineComment ( v: lnum , 1 )
248
256
return cindent (v: lnum )
249
257
endif
250
258
0 commit comments