Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Incrementor Objects for Vim
tree: 7bee653118

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.



Incrementor Objects for Vim

By default, Nexus comes with three global incrementor objects:

  • s0

  • s1

  • inc

The s1 object has a method called next() which returns the next number in the series. As his name implies, the first such number is 1. There is a corresponding s0 object whose first call to next() yields, of course, the number 0. The gentle user is free to create their own series objects too:

:let even_seq = Series(0, 2)

The command:


will print 2 on the first call, then 4, then 6, 8, 10, etc, on subsequent calls.

The Series constructor has the following signatures:

  • Series() → starting at 0 with an increment of 1 → 1, 2, 3, 4, …

  • Series(7) → starting at 0 with an increment of 7 → 7, 14, 21, 28, …

  • Series(7, 2) → starting at 7 with an increment of 2 → 9, 11, 13, 15, …

  • Series(2, 7) → starting at 2 with an increment of 7 → 9, 16, 23, 30, …

Nexus’s Series Objects provide the following methods:

  • reset() to set the object back to its original values when created

  • next() to increment and return the next number in the series

  • inc() as an alias for next()

  • value() to return the current value without incrementing internal state

  • val() as an alias for value()

  • set() to explicitly alter the internal value (but not increment amount)

I use s1 a lot in my daily vimming. It could be useful to you too.

Something went wrong with that request. Please try again.