Hi Ingo!
On Fr, 13 Mär 2015, 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
>
> I guess the command parser doesn't backtrack when the closing "]"
> isn't found, and instead uses the remainder as the pattern (even
> though the "/" separators aren't escaped and therefore are valid
> separators).
>
> Though this came up in a (wrongly typed) command [1], it's unlikely
> that this problem occurs during interactive use. I'm more worried
> about plugins automatically inserting the last search pattern into a
> generated command and then failing unexpectedly, e.g.:
>
> execute 'substitute/' . @/ . '//g'
This has happened to me in the past several times. So I would strongly
suggest the docs to discourage the use of it
Best,
Christian
--
Altranft, der
Geruch leerstehender Wohnungen und Wochenendhäuser.
-- Douglas Adams, John Lloyd, Sven Böttcher ("Der tiefere Sinn
des Labenz")
--
--
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.