I do have a bunch of XHTML files and I need to put an @id
for all the p
elements inside all those files.
I have tried the following argdo
approach in the following way:
:cd d:\testfiles\
:args *.xhtml
:argdo let i = 1 | g/<p/s/<p/\=printf("<p id=\"para%02d\"", i)/ | let i = i + 1
Now, this works fine. Doing it by this way value of i
is getting incremented all the time. But, I want it to use unlet i
, whenever argdo
executes to a new buffer. In short, variable i
must be set to 1
for each item in the arg-list
.
I also have tried to use |unlet i
at the end of the argdo statements
or at the beginning of the argdo statements
. But both ways have failed.
Is there any workaround? I am very new to vim
. Using it only a few months and loving it day by day. Pointing out my error to get job done, is greatly appreciated.