-   Linux - Newbie (
-   -   replace a word in vim editor (

fssengg 03-10-2005 08:17 AM

replace a word in vim editor
I am using vim editor and i want to know how can i replace all occurance of a word with an other word? is there any built in command in vim to do this?

jxi 03-10-2005 08:24 AM

you have help in vim

while in command mode try:

:h replace

druuna 03-10-2005 08:26 AM


In command mode:


This will change all instances ofTHIS in THAT. the % is the line range (% = all), you could also do this: 5,15, which will change occurences in lines 5 to 15 (included).

The g on the end makes sure that all occurences in one line are changed. If you don't use the g, only the first instance will be changed.

Take a look here for a short vi tutorial: vi tutorial

Hope this helps.

fssengg 03-10-2005 08:39 AM

thankx for ur help it solved my problem

All times are GMT -5. The time now is 01:12 PM.