Is there a way to generate a number sequence in vi or Vim?
For example, for an arbitrary range of lines i through j (where i < j
I think all the proposed solutions are too difficult to remember, you can use it once but then you need to go into all details every time you use it (if you use it less than once a day or so).
I found the visual incrementing script really easy to install and use. Once it is installed in vim, you just need to generate a column of 0's, select it with Ctrl-V and write the command :I. It will then automatically generate increasing numbers on each line. There are also other features:
This solves a more general problem because it works also at a position different from column 0, the column has just to be selectable with Ctrl-V.
The vimball of the plugin is here or here.