Global search & replace in Vim

Mark Szidik szidikm@mlc.lib.mi.us
Thu, 14 Jun 2001 13:54:39 -0400 (EDT)



 :%s/string1/string2/g

  ^  The %s will do the trick on the whole file.

See the resources section of www.gllogu.org for a Vi turorial by
yours truly.


______________________________________________________________________
Mark Szidik
System Administrator           Ph: 517.694.4242 x17  Fax: 517.694.9303
Michigan Library Consortium    http://www.mlc.lib.mi.us

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:
>
>
>   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.