[Cialug] vi substituting

Colin Burnett cmlburnett at gmail.com
Sat Jan 26 10:55:51 CST 2008


On Jan 26, 2008 9:40 AM, Todd Walton <tdwalton at gmail.com> wrote:
>
> I open the file and say ":s/thisthis From/From/g".  vim tells me
> "E486: Pattern not found: thisthis From".  Horse baloney!  If I just
> straight search for it with "/thisthis From" then it finds it.  I can
> see it right in front of my face.
>
> Why doesn't vim see it when substituting?

The s command applies to only the current line.  You must specify a
range for the s command to work on more than the current line

:%s/.../.../

will replace the first instance on every line.

:%s/.../.../g

will replace all instances on every line.


Colin


More information about the Cialug mailing list