From 2abec5b9ed0444b8592a2646a7d505f0d4555d0c Mon Sep 17 00:00:00 2001 From: "Andy K. Massimino" Date: Sun, 26 Jan 2020 17:14:45 -0500 Subject: [PATCH] Change default syntax skip method (fixes #82) --- autoload/matchup/util.vim | 11 +++-------- test/vader/syn.vader | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 test/vader/syn.vader diff --git a/autoload/matchup/util.vim b/autoload/matchup/util.vim index 4fa365d..ee95f06 100644 --- a/autoload/matchup/util.vim +++ b/autoload/matchup/util.vim @@ -40,14 +40,9 @@ function! matchup#util#in_syntax(name, ...) " {{{1 " usage: matchup#util#in_syntax(name, [line, col]) let l:pos = a:0 > 0 ? [a:1, a:2] : [line('.'), col('.')] - " check syntax at position - let l:syn = map(synstack(l:pos[0], l:pos[1]), - \ "synIDattr(synIDtrans(v:val), 'name')") - return match(l:syn, '\c'.a:name) >= 0 - - " this is closer to the method used by most ftplugins - " let l:syn = synIDattr(synID(l:pos[0], l:pos[1], 1), 'name') - " return l:syn =~? a:name + " check syntax at position (same as matchit's s: method) + let l:syn = synIDattr(synID(l:pos[0], l:pos[1], 1), 'name') + return l:syn =~? a:name endfunction " }}}1 diff --git a/test/vader/syn.vader b/test/vader/syn.vader new file mode 100644 index 0000000..8d7a784 --- /dev/null +++ b/test/vader/syn.vader @@ -0,0 +1,17 @@ +Execute (opts): + let matchup_matchparen_offscreen = {} + let matchup_delim_noskips = 2 + +Given scheme (Syntax): + (define procname ; ) in comment isn't matched as expected + ") in string is however matched" + body) + +Before (): + 2normal! f) + +Do (%): + % +Then (Verify line): + Assert line('.') == 2 +