I find myself more then once doing this repetitive thing:
I have something like:
do amount_foo blah_blah
I need to copy this n times, but change the foo part. I copy and paste it as many times as needed:
do amount_foo blah_blah
do amount_foo blah_blah
do amount_foo blah_blah
do amount_foo blah_blah
Then a replace on one and one line:
:'<,'>s/foo/bar
:'<,'>s/foo/baz
:'<,'>s/foo/lot
So I get:
do amount_foo blah_blah
do amount_bar blah_blah
do amount_baz blah_blah
do amount_lot blah_blah
Is there a quicker way to do the same? Is there for example a way to pass a list to replace so that one could do:
:'<,'>s/foo/\=some_magic bar, baz, lot
Easy enough to write a function for it, but there is perhaps a better way to do this natively?
/foo<CR>ciwbar<Esc>nciwbaz<Esc>...) – Rich Mar 13 '18 at 16:13cenotciw. Or if the match is more complicated thanfooI might usecgn. – Rich Mar 13 '18 at 16:29