I have this code:
array (\'id\' => 1, \'name\' => \"Murka\", \'date_of_birth\' => \"2014-10-31\", \"breed_id\" => 1),
array (\'id\' => 1, \'na
Another approach. go to the second line, put the cursor over the first 1, now start a visual block selection Ctrl-v, press j
until the line you want increment and press g Ctrl-a
A really easy solution:
:%norm f1s^R=line('.')^M
Obtained like this:
:%norm f1s<C-v><C-r>=line('.')<C-v><CR>
If you are not comfortable with typing complete macros on the command-line you can achieve the same result via recording:
qq
f1s<C-r>=line('.')<CR>
q
[range]@q
I don't have an answer to your general question, but I do have one for your specific situation. You can make your command work by putting the comma into a positive look-ahead, like this:
:let i=1 | g/1(\,\)\@=/ s//\=i/ | let i+=1
Now it will only replace the 1
.