On Sun, Jul 26, 2020 at 4:42 PM Bram Moolenaar <[email protected]> wrote:
>
>
> Tony wrote:
>
> > 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.
>
> Thanks for pointing out. I think a simpler way is to add [^(], that is:
> match anything but a paren. A quick test shows that this works.
According to the help it requires one character, while )\@! matches
with zero length. The construct
function
\ foobar(...)
would be matched by the one but not by the other, but maybe it is a
marginal case that can be ignored? Also, the given regexp ends (after
the \%( \) group) with \> ; I thought that in
function foobar(x,y)
the space after "function" (or the first space, if several) would not
be seen as _followed_ by an end-of-word? (That space is, IIUC, what
[^(] matches)
Best regards,
Tony.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/CAJkCKXtArObSTBihnjeXXSy6v4omjgfZ%3Dmc1TXvUwR68AWWxHg%40mail.gmail.com.