Den fre 14 okt. 2022 15:14rwmit...@gmail.com <rwmitch...@gmail.com> skrev:

> As far as I know '%' auto-jumps to matching parens/etc.


It does, but this is for inside a regex pattern, i.e. match balanced parens
and any number of contained balanced parens, including recursively to any
depth like "(...(...)...(...(...(...)...)...)...)". The rub is the
recursive bit. Some regex engines, notably PCRE and Perl has pretty nifty
support for recursive patterns[^1]. Lua patterns have something simpler,
the construct `%b()` — where `(` and `)` may be any two chars/bytes but
typically are one of the pairs () {} [] <> for obvious reasons. It matches
properly balanced parentheses including recursively nested. The only
limitation is that the matched text may not contain any unbalanced parens,
so e.g. "( () (  ) " won't match. Unlike PCRE/Perl you can't specify what
the outer parens shall contain; rather you just match a pair of balanced
parentheses which may contain non-parentheses and/or nested balanced
parentheses. It is still powerful enough in most cases, and I would hope
that someone be willing to add such a construct to Vim regexes.

[^1]:
https://metacpan.org/dist/perl/view/pod/perlre.pod#(?PARNO)-(?-PARNO)-(?+PARNO)-(?R)-(?0)


> However, I am also using:
> https://github.com/andymass/vim-matchup
>
> On Friday, October 14, 2022 at 8:53:37 AM UTC-4 Benct Philip Jonsson wrote:
>
>> Is there any way to match nested balanced parentheses or other delimiters
>> in Vim patterns? I wish there were at least something like %b() in Lua
>> patterns. (I see \%b is unused, so perhaps Vim can steal the Lua syntax! :-)
>>
>> --
> --
> You received this message from the "vim_use" 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_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vim_use+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/ba41062b-ff77-4215-958a-1a970e6abf53n%40googlegroups.com
> <https://groups.google.com/d/msgid/vim_use/ba41062b-ff77-4215-958a-1a970e6abf53n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/CADAJKhDdjGCfwe1Dp4BZkk884BXJAXRuWht7rdqSnFjBVSPcRw%40mail.gmail.com.

Reply via email to