:let @a=1 | %s/<old_word>/\='<new_word>'.(@a+setreg('a',@a+1))/g
If the <old_word> is replaced with abc
and <new_word> with xyz
:let @a=1 | %s/abc/\='xyz'.(@a+setreg('a',@a+1))/g
The command will replace all abc with xyz.<number>. The <number> will start with 1 and increment by 1.
1st abc will be replace by xyz.1
2nd abc will be replace by xyz.2
.
.
.
so on
No comments:
Post a Comment