[Cialug] vi substituting

Eric Junker eric at eric.nu
Sat Jan 26 10:52:22 CST 2008


Todd Walton 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?

I think what happened is that it replaced it on the first line but then 
says "Pattern not found" because there are no more occurrences on that 
line. You need to use :%s/thisthis From/From/g The % symbol tells it to 
perform the replace on all lines.

Eric


More information about the Cialug mailing list