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
The Nexus plugin provides the Series type and an object, s1, of that type used like this:
:4,8s/^/\=s1.next().' '/
Nexus also comes with an s0 Series object that yields 0 as its first .next() result. Both s0 and s1 use a 1-step increment. All Series objects have a .reset() method which sets them back to their initiated value. New Series objects can be created like the following call:
let s2 = Series(0, 2)
which creates a 2-step object meeting your second request (yielding: 2, 4, 6, 8, etc.).