Let's say I have some code:
divide(int x) {
int a = 0;
a += x;
}
subtract(int x) {
int b = 0;
b += x;
}
multiply(int x) {
int c = 0;
c += x;
}
I'm using VIM and I'd like to be able to search and replace each instance of += with {'/=', '-=', '*='}
in that order, using the vim command line.
I'd like to use :%s/+=/...
, but I'm not sure how.
I also thought about using python in vim like this, but I would prefer a simpler solution entirely in VIM, if possible.