Classical replace command looks like
%s/old_pattern/new_pattern which is fine, but working with code or constructing complex search regular expression is not the best option. I'd like to present my own solution and looking for better options.
Another workflow you can consider:
- Search for word using
- Make your change with
cgnwhich change the next matched pattern.
.will make the same change, for the next occurrence of the pattern. (so you can
.... to see each change, one at a time)
My current workflow looks like:
Search for word using
Replace first occurrence using
:s//new_patternthis works because empty search pattern in this command will use content of the search register
"/which contains the last search pattern in our case
Apply replace to all buffer using
g&which is a shortcut to the
Suggestions are welcome.