How to renumber a list in vim?
I wrote a section of a webpage with the following bit ...
<span id="item01"> some first presented text</span>
<span id="item02"> some other text, presented second</span>
<span id="item03"> more text</span>
....
<span id="item15"> last bit of text.</span>
Then I realized that it should be numbered from 14 to 0, and not from 1 to 15. (Yes, poor design on my part, not JavaScript planning in the first place.)
Question. Is there an easy way in vim to do math by numbers in a regular expression? What I would like to do is search the text "item [00-99]" and return the text "item (15-original number)"
The search seems simple enough - / item ([0-9] [0-9]) / (brackets to put the numbers found in the buffer), but is it even possible to do the math on this?
Macro for creating numbered lists in vim? gives you the opportunity to number something from scratch, but I'm looking for a method of renumbering.