-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 14-Mar-2015 02:11, James McCoy wrote:
> On Fri, Mar 13, 2015 at 09:54:18PM +0100, Ingo Karkat wrote:
>> it's possible to avoid escaping a "[" character:
>>
>> ,----[ :help E769 ]---- | When the ']' is not there Vim will not
>> give an error message but | assume no collection is used. Useful
>> to search for '['. `----
>>
>> But when using that feature in a :substitute command, the
>> replacement part is mistakenly added to the pattern:
>>
>> :s/[//g E486: Pattern not found: [//g
>
> No, that's not what's happening. You can leave off the entire
> replacement and the delimiter before it. When this happens, Vim
> treats it as deleting the matching strings. To quote:
>
> If the {string} is omitted the substitute is done as if it's empty.
> Thus the matched pattern is deleted. The separator after {pattern}
> can also be left out then. Example: > :%s/TESTING This deletes
> "TESTING" from all lines, but only one per line.
Right. My point is that because the "/" delimiters are not actually
left off (they are there, in the correct, unescaped form), the :s
command *mistakenly* runs into the case you've quoted. Putting it yet
another way, the "[" consumes the following characters (including the
unescaped separators), assuming they belong to the collection, and
when at the end the collection isn't closed, the parsing should
backtrack and reinterpret, but it currently doesn't.
- -- regards, ingo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
iQEcBAEBAgAGBQJVA/McAAoJEA7ziXlAzQ/vzY8H/iDaGOuDaf37RwtzzjInRVWO
U3pWmVO5JGkJb+CZTBNRPBEZmL+5NewPooyAf0vmh+AimXJFl53AQbwoX0sdtr2S
x2BqT39WlsTh9DGlDA3TNGGy2buDGEwkjDSDhFckgTWB+6O52H4WcKtIo7IXZlE2
UPbRKrghxzIUGPeNqW0KC+om70TodkoklBIuGawJo8em0ZRkqPXWQM8GRXKUnkr2
q+raryMcoo3LN3aqURC1Xa9YCdmfvAj0JY3H0YQL7cTdX1fKIwcewcVT6SeY1zWl
gXt+FVmHqBGyYttjyf8YzAJqM9e73bq5KKmzRkAiTun4v3HsuktbvxeFG+dw1t4=
=SoRY
-----END PGP SIGNATURE-----
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.