Reply to message «Re: Replacing a visual selection», sent 13:39:46 22 April 2011, Friday by Ben Schmidt:
> Something else nobody has mentioned is that putting \V at the beginning > of the pattern (for very nomagic) can at least lessen the number of > characters that need to be escaped. Not very helpful, but something > that's handy to know, perhaps with other more convenient uses. As described in help, it won't just lessen the number of characters. It will leave exactly one character with special meaning: backslash. I widely use this in scripts: ``'\V'.escape(str, '\').'\v''' will search for string, stored in str variable, no matter what characters this string does contain. This is somehow similar to perl's `/\Q$str\E/'. Original message: > On 21/04/11 8:37 PM, Kai Weber wrote: > > Hi, > > > > Currently my workflow replacing a visual selection is like this: > > > > 1. Go to Visual mode > > 2. Select text > > 3. y'ank > > 4. :%s/<c-r>*/foo/g > > Something else nobody has mentioned is that putting \V at the beginning > of the pattern (for very nomagic) can at least lessen the number of > characters that need to be escaped. Not very helpful, but something > that's handy to know, perhaps with other more convenient uses. > > Ben.
signature.asc
Description: This is a digitally signed message part.
