matchit problems

13 views
Skip to first unread message

Charles Campbell

unread,
Jun 29, 2020, 1:25:20 PM6/29/20
to Christian Brabandt, vim...@googlegroups.com
Hello, Christian:

I see that you've picked up maintaining the matchit plugin.  I've been
having problems with it recently -- problems that I didn't used to have.

* I used to be able to use the % key, in vimscript, to jump between if
.. elseif ..endif
* I used to be able to bypass {{{3 in comments and still matchit-jump
between matching {...}s.

To do these things I have in .vim/after/ftplugin, for vim:

" Custom MatchIt Support: {{{1
let b:match_words=
'\<fu\%[nction]\>:\<retu\%[rn]\>:\<endf\%[unction]\>,\<wh\%[ile]\>:\<brea\%[k]\>:\<con\%[tinue]\>:\<endw\%[hile]\>,\<if\>:\<el\%[seif]\>:\<en\%[dif]\>,\<try\>:\<cat\%[ch]\>:\<fina\%[lly]\>:\<endt\%[ry]\>,\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,(:),\<for\>:\<endfor\=\>'


In .vim/ftplugin/c I have, for c:

" Custom Matchit Support: {{{1
let b:match_words=
   \ '\%(\<else\s\+\)\@<!\<if\>:\<else\s\+if\>:\<else\%(\s\+if\)\@!\>,' .
   \ '\<switch\>:\<case\>:\<default\>,'.
   \ &matchpairs

and in .vim/ftplugin/syntax/c I have, for c:

syn match    cFolding            "{{{\d\+" containedin=cComment
syn match    cFolding            "}}}\d\+" containedin=cComment

" modify matchit to exclude matching {}s and whatnot inside ChipDbg
strings
let b:match_skip='synIDattr(synID(line("."),col("."),1),"name") =~?
"cComment\\|character\\|special\\|ChipDbg\\|cFolding"'

I verified this by not seeing the desired behavior with the current
matchit and verifying that did work properly with the old matchit. For
now, I'm using the Benji F's matchit...

Regards,
Chip Campbell

Christian Brabandt

unread,
Jul 1, 2020, 3:01:58 AM7/1/20
to vim...@googlegroups.com
Hm, for me it works without problems with the default b:match_words from
$VIM/ftplugin/vim.vim

Can you provide a reproducible example of what does not work, I'll have
a closer look then, thanks!


Mit freundlichen Grüßen
Christian
--
So viel Geld läßt sich, weiß Gott, nicht mit etwas Gutem verdienen.
-- Friedrich Schiller (Kabale und Liebe)
Reply all
Reply to author
Forward
0 new messages