Re: matchit

17 views
Skip to first unread message

Elimar Riesebieter

unread,
Mar 13, 2022, 10:30:28 AM3/13/22
to vim_use
* Elimar Riesebieter <ries...@lxtec.de> [2022-03-13 13:59 +0100]:

> Hi all,
>
> since a while I didn't get matches if/fi anymore. I am running
> packadd! matchit. Fror instance brackets are matching...
>
> How can I debug it?

:echo exists("loaded_matchit")

gives 1

Elimar
--
Excellent day for drinking heavily.
Spike the office water cooler;-)

Elimar Riesebieter

unread,
Mar 13, 2022, 10:30:36 AM3/13/22
to vim_use
Hi all,

since a while I didn't get matches if/fi anymore. I am running
packadd! matchit. Fror instance brackets are matching...

How can I debug it?

Thanks in advance
Elimar
--
The path to source is always uphill!
-unknown-

Bram Moolenaar

unread,
Mar 13, 2022, 12:05:25 PM3/13/22
to vim...@googlegroups.com, Elimar Riesebieter

Elimar Riesebieter wrote:

> > Hi all,
> >
> > since a while I didn't get matches if/fi anymore. I am running
> > packadd! matchit. Fror instance brackets are matching...
> >
> > How can I debug it?
>
> :echo exists("loaded_matchit")
>
> gives 1

Is this in a shell script? Please give more information.

--
Vi is clearly superior to emacs, since "vi" has only two characters
(and two keystrokes), while "emacs" has five. (Randy C. Ford)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Elimar Riesebieter

unread,
Mar 13, 2022, 1:37:47 PM3/13/22
to vim...@googlegroups.com
* Elimar Riesebieter <ries...@lxtec.de> [2022-03-13 14:21 +0100]:

> * Elimar Riesebieter <ries...@lxtec.de> [2022-03-13 13:59 +0100]:
>
> > Hi all,
> >
> > since a while I didn't get matches if/fi anymore. I am running
> > packadd! matchit. Fror instance brackets are matching...
> >
> > How can I debug it?
>
> :echo exists("loaded_matchit")
>
> gives 1

hl_matchit is what I was looking for.

Thanks
Elimar
--
>what IMHO then?
IMHO - Inhalation of a Multi-leafed Herbal Opiate ;)
--posting from alex in debian-user--

Adri Verhoef

unread,
Mar 23, 2022, 8:32:12 AM3/23/22
to vim...@googlegroups.com
Hi, I've been using Vi and Vim since the eighties. My current Vim
version is 8.2.4579, provided by Fedora Linux.

I have this line in a file:
<a href="[^"]+_trk([^"]+)">

When the cursor is on the first or second [, then the matching ] lights up.
When the cursor is on the first [ and I type %, the cursor jumps to the
second ].
When the cursor is on the (, the ) lights up.
When the cursor is on the ( and I type %, nothing happens.
When the cursor is on the underscore _ and I type %, nothing happens.

As a result, when the cursor is on the first [ and I type d%, the result is:
<a href="+)">

This bit me when I was editing the following line with the cursor on the
underscore _ and I typed d%, deleting 93 lines unexpectedly:

do { $credit[$n] = $2; $explicit[$n] = ""; $track[$n++] = $1; next } if
/<a class="a-size-base-plus a-link-normal a-color-base TitleLink
a-text-bold" href="[^"]+_trk([^"]+)">([^<]+)<\/a> <br\/> <span
class="a-size-base a-color-tertiary"> by <\/span> <span
class="a-size-base a-color-base">([^<]+)<\/span>/;

So, that's why I wrote "'%' matches but it doesn't when executed", as it
doesn't seem logical to me when a matching ) lights up and 'suddenly' it
doesn't match when I type %.

Adri (puzzled)
--
I lost a buttonhole somewhere today.

Eli the Bearded

unread,
Mar 23, 2022, 8:22:25 PM3/23/22
to vim...@googlegroups.com
Adri Verhoef <a...@a3.xs4all.nl> wrote:
> Hi, I've been using Vi and Vim since the eighties. My current Vim
> version is 8.2.4579, provided by Fedora Linux.
>
> I have this line in a file:
> <a href="[^"]+_trk([^"]+)">
>
> When the cursor is on the first or second [, then the matching ] lights up.
> When the cursor is on the first [ and I type %, the cursor jumps to the
> second ].
> When the cursor is on the (, the ) lights up.
> When the cursor is on the ( and I type %, nothing happens.
> When the cursor is on the underscore _ and I type %, nothing happens.

I suppose you know about the M and % compatibility options?

:help cpo-M
:help cpo-%

It sounds like the matchparen plugin is showing you a "match" without
properly taking the cpoptions setting into account or is being confused
by the syntax highlighting guess of content type. Personally I find
matchparen and showmatch highly distracting and don't use them. Maybe
you'd enjoy that, too.

For the plugin:

:help pi_paren.txt

Elijah
------
will spare you the parse html-with-regexp comments

Adri Verhoef

unread,
Mar 24, 2022, 9:04:19 AM3/24/22
to vim...@googlegroups.com
On 24/03/2022 01:22, Eli the Bearded wrote:
> Adri Verhoef <a...@a3.xs4all.nl> wrote:
>> Hi, I've been using Vi and Vim since the eighties. My current Vim
>> version is 8.2.4579, provided by Fedora Linux.
>>
>> I have this line in a file:
>> <a href="[^"]+_trk([^"]+)">
>>
>> When the cursor is on the first or second [, then the matching ] lights up.
>> When the cursor is on the first [ and I type %, the cursor jumps to the
>> second ].
>> When the cursor is on the (, the ) lights up.
>> When the cursor is on the ( and I type %, nothing happens.

> I suppose you know about the M and % compatibility options?
>
> :help cpo-M
> :help cpo-%

I did read that before posting, yes.

> It sounds like the matchparen plugin is showing you a "match" without
> properly taking the cpoptions setting into account or is being confused
> by the syntax highlighting guess of content type. Personally I find
> matchparen and showmatch highly distracting and don't use them. Maybe
> you'd enjoy that, too.

Actually, I've never found it too distracting, so never thought of
turning it off.

Still, Vim shows one thing and does the other. That is not logical.
Is that because the old Vi (behaviour) does the wrong thing?
Because if I do in Vim:
se cpoptions=aABceFs (this is my default, apparently)
se cpoptions+=%
... then it works as expected, i.e. logically. WYSIWYG. :-)
And when I do
vim -u NONE "+se cpo"
I get:
cpoptions=aAbBcCdDeEfFgHiIjJkKlLmMnoOpPqrRsStuvwWxXyZ$!%*-+<>;

Adri
Reply all
Reply to author
Forward
0 new messages