When writing sometimes I have to replace several different words successively, say a1 -> a2, b1->b2, c1->c2 and so on.
For this I manually edit the command history so I start with
:s/a1/a2/gc
after go and replace a1 and a2 by b1 and b2, do the substitution and continue to the next item.
The work flow I would like to have would be something like:
:let in = ['a1', 'b1', 'c1']
:let out = ['a2', 'b2', 'c2']
:call ReplaceAllWithConfirmation(in, out)
where ReplaceAllWithConfirmation would be a function that would perform the the substitutions but asking me to confirm each time.
Would this be possible?
Thanks!
You don’t need to write a function. Just run this command:
You can have a expression after
\=.