Usually I deal with files that look like this:
0.98 3.45
2.45 3.90
.
.
.
4.56 8.45
Let's say with 100 lines, I would like to get something like this:
1 0.98 3.45
2 2.45 3.90
.
.
.
100 4.56 8.45
I.e., a first column of integers, incremented for each line. What I usually do is to generate a column file with just the numbers 1,2...100 and then select that block and paste it into the file with two columns. As the number of rows is almost always different my approach seems to be very slow.
Do you have any suggestions?
:%s/^/\=printf('%-3d ', line('.'))
More information:
:help :s\=
:help printf()
:help line()