VisIncr plugin for Vim

VisIncr

One of the most powerful aspects of using Vim is that you never have to do any drudge work. All boring repeatable tasks can be executed with a meaningful command. A recent problem I ran into was to create variable names with a large number of incrementally increasing indices. I found an awesome plugin by Dr. Chip called VisIncr that automates this very useful operation.

  • Install: Use your favorite Vim plugin installation method to install this plugin from this URL: https://github.com/vim-scripts/VisIncr

  • Usage: Let us assume I want to generate variables ranging from x_3 to x_16. I first type x_3 and repeat it 13 times one on each line. Mark the column containing 3 using visual block (Ctrl+V). Then press I and press Enter. Boom! See the output in above image. The command I is easy to remember cause the operation is i-ncrement.

  • You can refer to the documentation for the commands to increment with right justification (default is left), by a different increment or want to increment octal number, Roman numerals or dates. Pretty much any scenario that appears in code is covered by the plugin.

Tried with: Vim 7.4 and Ubuntu 16.04

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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