Vim finding and replacing without captures
Normally when doing find and replaces in a file there are some key words that we want to key off, but not replace. This can be a pain because you have to then isolate the part you want to change, capture everything but the changing part, and then reconstruct it in the substitution. Well there is a better way…
If your goal is to prepend all of the name=”bad-.*” with name=”good-.*”, then we would normally have to write something like:
There is a better way using zoom start ‘\zs’ and zoom end ‘\ze’:
Happy finding and replacing!
TheSoftwareProgrammer View All
I like science and writing software.
Leave a Reply