I have the following lines:
abc07
bca08
xyz17
And I would like to transform it to:
[0]="abc07" \
[1]="bca08" \
[2]="xyz17" \
Based on this question, I can do the first part and the end part separately, like this:
FIRST PART
:let i=0 | g/^/execute "normal! I" . printf("^I[%d]=\"", i) | let i+=1
OR
:let i=0 | g/^/s/^/\=printf("^I[%d]=\"", i)/ | let i+=1
SECOND PART
:%s/$/\"\ \\/g
But I am unable to combine these two in the same command. (Yes, I know, I overcomplicate things...) Can you help me out to combine the two parts in one command? An entirely different solution is also OK for me.