4

I'm kind of confused about why doesn't Vim accept di> operation on this piece of text:

<This is a random text but has a backslash at the end\>

but rather does on this:

<This is a text with no backslash at the end>

Does it has to do something with the backslash which is obstructing vim recognizing <> as a text object?

I'd really like a workaround for this.

0

1 Answer 1

4

I have noticed that regression, too, which seems to affect all text objects with single character boundaries:

i<
i"
i'
i{
etc.

You should report it if it hasn't been reported already.


EDIT

FWIW, that behavior is expected for the "quotes" text objects and even governed by an option:

The 'quoteescape' option is used to skip escaped quotes.

But a) it is not mentioned in the other text objects and b) :help 'quoteescape' only mentions quotes text objects.

So, either the "non-quotes" text objects like i< must be fixed (stop doing what only the "quotes" text objects are supposed to do) or it is their documentation (mention quoteescape).


MORE EDIT

I just tried in a 7.4 build and the behavior was the same. Therefore, i< not selecting anything if there is a \ just before > is not a regression in and on itself.

There are some problems, though:

  1. As mentioned above, that behavior is documented for the "quotes" text objects but not for others.

  2. Changing the value of quoteescape works for the "quotes" objects but not for the others.

Where can we go from there?

IMO, it is very important that the documentation and the actual behavior are in sync. From that perspective, adding a simple sentence like the one I quoted from :help a' could probably be enough BUT…

  • quoteescape seems to only be honored by "quotes" object,
  • if we want the other objects to honor quoteescape, then its name is a bit problematic.
6
  • It could make sense for i' and for i". But maybe it should be configurable. Sep 27, 2023 at 14:18
  • is that a regression? If so, can someone please bisect to the relevant commit? Sep 27, 2023 at 16:16
  • @ChristianBrabandt please see my edit
    – romainl
    Sep 28, 2023 at 7:57
  • 2
    I only had a cursory look at the source, but you can make it work by :set cpo+=M. I guess I'll adjust the documentation, that the cpo-M flag applies for escaped delimiters or something similar Sep 28, 2023 at 8:22
  • 2
    I have documented that now at: github.com/vim/vim/commit/… Sep 29, 2023 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.