On Sun, 21 May 2006 15:25:04 +1200
Hadley Rich <[EMAIL PROTECTED]> wrote:

> On Sunday 21 May 2006 15:18, Andy George wrote:
> > ...in VI the editor-of-the-gods...
> >
> > How do you do a word find/replace?
> 
> :%s/find/replace/g
> 
> Will replace find with replace in the whole document (%) and be greedy (g) 
> i.e. replace more than one occurrence on a line.
> 
> Of course you are correct;
> 
> http://www.google.co.nz/search?q=vim+search+replace
> 
> could easily tell you as well.
> 
> hads
> 
> -- 
> Make it idiot-proof, and someone will breed a better idiot.
>               -- Oliver Elphick
... it'll replace every occurrence of the search string with the replaced 
string, which may be more than you want. For example, %s/Cant/Can/g will also 
convert Canterbury to Canerbury.

If you want to check each one, use /search to find the first occurrence of the 
offending word, then cwreplace<ESC> to replace it with your new word. From that 
point on, n will find the next occurrence, and . will repeat the last action ( 
ie change word ).

Hope this make sense. It's certainly more fun han the last 90 minutes getting 
wu-ftpd to accept incoming ftp without manually issuing the passive directive 
(: (If you need to know, then it's to add the line 'pasv-allow all 0.0.0.0/0' 
into /etc/wu-ftp/ftpallow).

Steve

Reply via email to