I usually either end up using [range]%s/word/another_word/gc
or do it manually. I wonder if you guys use a different, perhaps a faster, way. Assume that I have vim 7.2.
views:
74answers:
2
+3
A:
&
in command-mode repeats the previous search-and-replace command. You can also do things like 3&
to repeat it over the next 3 lines.
Kristo
2009-09-04 20:52:26
+5
A:
I usually use /word
plus enter to find the word; cwanother
plus ESC to replace it the first time; then n
to find the next occurrence of the word (possibly a few times if it appears several times on the line and I don't want to change every one), and then .
to repeat the last change.
I use the range based global search-and-replace when the occurrences are scattered throughout an extensive range and it is really global search-and-replace that I want.
Jonathan Leffler
2009-09-04 20:59:28