How to insert incremental numbers in Vim using Visual Incrementing script

The Visual Incrementing script is one of the many awesome scripts created by Dr. Chip for Vim. What it does is simple: if you can mark a vertical visual block in Vim, it will replace that with a list of incrementing numbers.

For example, if you marked out a vertical visual block like this:


Using this script, you can replace it with:


I use this most frequently along with ViDir to append incrementing numbers to a bunch of files from inside Vim. How awesome is that? 🙂

To use this script:

  • It ships as a VimBall. To install it follow this post.

  • Identify the vertical block of text you want replaced by incremental list of numbers. Set the first text to the first number you want in the list.

  • Visually mark the vertical block of text using Ctrl-V.

  • To replace with incremental list of numbers enter the command: :I and press Enter.

  • To increment with different increments and other options, see the help of this script.

Tried with: Vim 7.4 and Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s