Last Updated: February 25, 2016
·
341
· arminas

Vim repeat subsitution

After doing some substitution like
:s/foo/bar
press "n" for next occurrence of "foo" and then press "&" to repeat replacement if necessary.

2 Responses
Add your response

:%s/foo/bar // start from the top of the file and do them all
:%s/foo/bar/c // start from the top of the file and confirm you want to do it

over 1 year ago ·

Or you can change then all (globally in the file) in one command without confirmation:

:%s/foo/bar/g
over 1 year ago ·