Re: matchit

已查看 17 次
跳至第一个未读帖子

Elimar Riesebieter

未读,
2022年3月13日 10:30:282022/3/13
收件人 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

未读,
2022年3月13日 10:30:362022/3/13
收件人 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

未读,
2022年3月13日 12:05:252022/3/13
收件人 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

未读,
2022年3月13日 13:37:472022/3/13
收件人 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

未读,
2022年3月23日 08:32:122022/3/23
收件人 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

未读,
2022年3月23日 20:22:252022/3/23
收件人 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

未读,
2022年3月24日 09:04:192022/3/24
收件人 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
回复全部
回复作者
转发
0 个新帖子