I know the regex for doing a global replace,
%s/old/new/g
How do you go about doing an interactive search-replace in Vim?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Add the flag c (in the vim command prompt):
will give you a yes/no prompt at each occurrence of ‘old’.
Vim’s built-in help offers useful info on the options available once substitution with confirmation has been selected. Use:
Then scroll to section on confirm options. Screenshot below:
For instance, to substitute this and all remaining matches, use
a.