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.
Cheers,
--
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <[email protected]>
--
--
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.
signature.asc
Description: Digital signature
