-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Vim developers,

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'

- -- regards, ingo

[1] http://vi.stackexchange.com/questions/2538/regex-how-to-replace
- -- 
  -- Ingo Karkat --  /^-- /^-- /^-- /^-- /^-- http://ingo-karkat.de/ --
  --   http://vim.sourceforge.net/account/profile.php?user_id=9713   --
Using Vim for 13 years now, mostly 'cos I can't figure out how to exit it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)

iQEcBAEBAgAGBQJVA056AAoJEA7ziXlAzQ/vhIAH/ij6W9Iz3GnkG0ReeB9c8AVf
2ILB+V/YgIPNvKWR4GHgPgcsaAS7tMFDpYwi0RLuLBVGQAR31rlcqnmPUDYxj8ip
ZjUh0y5nkUUPOuW41YD2Njy6eY0GWAB0PO3NRxJRYChhHPV650vV3M/zav412N6N
Tv9/0hE4ItxTl1V0MW85T60vuUv6M5cFgyHV4H0GJ6FHPdCjt5x/vwKej1yki4fa
LMLti7p0auinbcHItWimjHdRnwKToaR2g1hny9D19k6N0jpDapRp6rA3mMLTMUWW
4+GX6+9ZYi1WEHzqdTAJwWX1lbJhm1DR2vA/NLT3/xm0opIkH3i5FEyYesQqBf8=
=mxIh
-----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.

Raspunde prin e-mail lui