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 + 1Now, 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.
How to `unlet` a variable using from a `argdo` statement in VIM
buffers;variables
When you use a variable without a scope (i instead of b:i or w:i, etc.) outside of a function, you're using a global variable. From :h internal-variables:There are several name spaces for variables.  Which one is to be used isspecified by what is prepended:                (nothing) In a function: local to a function; otherwise: globalbuffer-variable    b:   Local to the current buffer.window-variable    w:   Local to the current window.tabpage-variable   t:   Local to the current tab page.global-variable    g:   Global.local-variable     l:   Local to a function.script-variable    s:   Local to a :source'ed Vim script.function-argument  a:   Function argument (only inside a function).vim-variable       v:   Global, predefined by Vim.A plain i is a variable common to all buffers. Since you need to reset the variable for each file, and each file will be in a separate buffer, you can use buffer-local variables (b:i instead of i).