Change default syntax skip method (fixes #82)

This commit is contained in:
Andy K. Massimino
2020-01-26 17:14:45 -05:00
parent 5a7dd99621
commit 2abec5b9ed
2 changed files with 20 additions and 8 deletions

View File

@@ -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

17
test/vader/syn.vader Normal file
View File

@@ -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