Not sure how easy this will be to fix; I just noticed it. Also not
sure of whether the problem is in matchit.vim, in
$VIMRUNTIME/ftplugin/vim.vim, or in both.
Software in use:
Vim or gvim, Big version, 8.2.1296
$VIMRUNTIME/pack/dist/opt/matchit/plugin/matchit.vim version 1.17
dated 2019 Oct 24
$VIMRUNTIME/pack/dist/opt/matchit/autoload/matchit.vim (Last change
Mar 01, 2020)
$VIMRUNTIME/ftplugin/vim.vim (Last change 2020 Jul 06)
The bug is exhibited, for example, when viewing the CSApprox.vim
plugin version 4.00 dated 14 Sep 2012; this is the latest version at
vim.org:
https://www.vim.org/scripts/script.php?script_id=2390
On my installation: ~/.vim/plugin/CSApprox.vim line 437
With matchit enabled, when viewing a Vim script where the function()
function is used within the range of a function definition (between
:function and :endfunction), hiting % on that :endfunction statement
goes to the function() invocation and vice-versa; hitting % on that
:function command does nothing.
The problem is of course due to the fact that b:match_words (for the
"vim" filetype) recognises "function" but does not skip "function(".
I'm attaching a proposed patch. Please check it, I haven't written
complex regular expressions in a long time.
Best regards,
Tony.