3 ms·
Personally, if my cursor was on the "foo" I'd probably use: *gcn<bar>. That is: * (highlight all occurrences of foo) gcn (globally changes the highligh
by Lio 6y ago
Personally, if my cursor was on the "foo" I'd probably use:
*gcn<bar>.
That is:
* (highlight all occurrences of foo)
gcn (globally changes the highlighted pattern)
<bar> (the text you want to replace with)
. (repeat the command as many times as you want).
If you know you want to change all the occurrences at once you can highlight "foo" with * (shift-8) and then use :%s//bar/g as it will be set as the last regexp.