Add the flag c (in the vim command prompt):
:%s/old/new/gc
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:
:h :s
Then scroll to section on confirm options. Screenshot below:
For instance, to substitute this and all remaining matches, use a
.
Related Contents:
- How can I make my match non greedy in vim?
- How can I add a string to the end of each line in Vim?
- Vim Regex Capture Groups [bau -> byau : ceu -> cyeu]
- How to get Vim to highlight non-ascii characters?
- Multi-line regex support in Vim
- How does one escape backslashes and forward slashes in VIM find/search?
- Capitalize first letter of each word in a selection using Vim
- vim regex replace multiple consecutive spaces with only one space
- Perform a non-regex search/replace in vim
- Vim regex backreference
- Find and replace whole words in vim
- Is there a way to do negative lookahead in vim regex?
- Why does VIM have its own regex syntax?
- how to make vim show ^M and substitute it
- Can I turn on extended regular expressions support in Vim?
- How do I replace or find non-printable characters in vim regex?
- Vim Regex : How to search for A AND B NOT C
- Vim: How do I search for a word which is not followed by another word?
- Vim positive lookahead regex
- Adding characters at the start and end of each line in a file
- What is the meaning of + in a regex?
- Vim search for a pattern and if occurs delete to end of line
- How do I match any character across multiple lines in a regular expression?
- Regular Expression to match only alphabetic characters
- Regular Expressions and negating a whole character group [duplicate]
- sed one-liner to convert all uppercase to lowercase?
- What flavor of Regex does Visual Studio Code use?
- Regular expression for matching latitude/longitude coordinates?
- How to print matched regex pattern using awk?
- Is there any way to put malicious code into a regular expression?
- Extract a regular expression match
- Regex group capture in R with multiple capture-groups
- Filter by regex example
- Regular expression for checking if capital letters are found consecutively in a string
- How to match Cyrillic characters with a regular expression
- Regex AND operator
- What regex can match sequences of the same character?
- How to match once per file in grep?
- Lua pattern matching vs. regular expressions
- Regex number between 1 and 100
- While replacing using regex, How to keep a part of matched string?
- Sublime Text: Regex to convert Uppercase to Title Case?
- Using named matches from Go regex
- Groovy syntax for regular expression matching
- Powershell: match operator returns true but $matches is null
- Is there an online RegexBuddy-like regular expression analyzer? [closed]
- Regex to match 2 digits, optional decimal, two digits
- Fuzzy Regular Expressions
- Perl iterate through each match
- Regex find word in the string