I am pretty new to vim and hence trying to learn some of its powerful features and ofcourse top of the list is macros.
So i am trying to create a pattern like this.
<tag>var 1</tag>
<tag>var 2</tag>
<tag>var 3</tag>
<tag>var 4</tag>
<tag>var 5</tag>
<tag>var 6</tag>
<tag>var 7</tag>
<tag>var 8</tag>
<tag>var 9</tag>
<tag>var 10</tag>
<tag>var 11</tag>
<tag>var 12</tag>
<tag>var 13</tag>
<tag>var 14</tag>
<tag>var 15</tag>
<tag>var 16</tag>
<tag>var 17</tag>
<tag>var 18</tag>
<tag>var 19</tag>
<tag>var 20</tag>
<tag>var 21</tag>
<tag>var 22</tag>
<tag>var 23</tag>
<tag>var 24</tag>
So i created the 1st line manually and then created a macro to do the rest, and i was able to do so, the problem is pressing @@
just creates one line and if i have hold down the @
to keep on creating new lines.
I know this is a little different problem because usually with macros we edit something in a line and then repeat it across multiple existing lines like n@<reg>
However in my case the file is empty and i am creating new lines, so how can i do this. This is what the contents of the register looks like
"q yypfr2l<80><fc>^Haghj
Well what i did was
- First yank the current line
- Paste it below
- Jump to next
r
which is invar
and then move 2 characters left which puts me at the number i want to change - Increment the number by 1
- Move to beginning of the line and then go down
So can i repeat this macro so that i can use it like 10@q
and so on. Please if i need to change my macro to meet the needs.
10@q
? What happened?