Global search & replace in Vim

Cory Spitz spitzcor@cray.com
Thu, 14 Jun 2001 13:34:21 -0500


:g/string1/s//string2

should work.

On Thu, 14 Jun 2001, Reza Beha wrote:

>
> Greetings, friends.
>
>    I've been fruitlessly seeking a method for replacing every instance of a string in Vim, without needing to know a file length or row range.  The best I've come up with so far is:
>
> :s/string1/string2/g xxx
>
>   Where 'xxx' is the length of the file (like 317 lines, for instance).  What is the proper way to accomplish this?  Thanks in advance.
>
> Migrating from VMS to Linux,
>
>                Reza
>
>
>
>
>
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Buzz Index - Spot the hottest trends in music, movies,and more.