sponsor Vim development Vim logo Vim Book Ad

increment.vim : quickly create incremented lists

 script karma  Rating 91/41, Downloaded by 2074    Comments, bugs, improvements  Vim wiki

created by
stanislav sitar
script type
Sometimes you want to search for a string in the text
and add an auto incremented number to each occurence of the string.
Let's say, you want to make a numbered list.
You write something like:
qwerty: The first line
qwerty: the second one
qwerty: and so on ...
Then you type a command
:let I=0
followed by a replace command
The first 'qwerty' is replaced by number 1,
the second by number 2, and so on... .
Sometimes you might want to generate numbers with a leadimg zeroes.
You simply initialize global variable I to value like
:let I=99890000
then you make the replacement
followed by

You have to initialize a global variable I
before the first use of INC() function,
othervise the numbering will continue where it stopped
during the last replace.

Text Pad has a very similar metacharacter for replacement - \i.
install details
Put increment.vim into a plugin directory.
Use in replacement strings

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
increment.vim 0.1 2001-11-15 6.0 stanislav sitar Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo