From 0738ad654d4f2f89b77dcb4197011a293e4dfcf3 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Mon, 2 Nov 2020 18:19:06 +0100 Subject: Update --- autoload/yats.vim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 autoload/yats.vim (limited to 'autoload/yats.vim') diff --git a/autoload/yats.vim b/autoload/yats.vim new file mode 100644 index 00000000..8f5fe2d0 --- /dev/null +++ b/autoload/yats.vim @@ -0,0 +1,20 @@ +if has_key(g:polyglot_is_disabled, 'typescript') + finish +endif + +" Regex of syntax group names that are strings or documentation. +let s:syng_multiline = 'comment\c' + +" Regex of syntax group names that are line comment. +let s:syng_linecom = 'linecomment\c' + +" Check if the character at lnum:col is inside a multi-line comment. +function yats#IsInMultilineComment(lnum, col) + return !s:IsLineComment(a:lnum, a:col) && synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_multiline +endfunction + +" Check if the character at lnum:col is a line comment. +function yats#IsLineComment(lnum, col) + return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_linecom +endfunction + -- cgit v1.2.3