Wednesday, March 23, 2022

'%' matches but it doesn't when executed

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.

--
--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/113c2290-aacc-bdda-c8f5-3dd34704ee5b%40a3.xs4all.nl.

No comments: