sponsor Vim development Vim logo Vim Book Ad

autonumbering in vim : Utility script to autonumber lines while editing

 script karma  Rating 11/9, Downloaded by 1459  Comments, bugs, improvements  Vim wiki

created by
Arun E
 
script type
utility
 
description
"Description: This script auto-numbers a list.
"
"General recommended settings for editing "*.txt" files
"set nocp et ts=4 sw=4 tw=80 ai
"
"HOW TO INSTALL (requires vim 7.0):
" - Drop the plugin under $HOME/.vim/plugin or
" - :source autonum.vim
"
"HOW TO USE:
" 1. Edit a file and type \as to activate autonumbering
" 2. Insert a number in the below-explained manner (1. )
" 3. Hit enter (A number is automatically inserted for you)
" 4. Hit ctrl-t, line is indented and numbered
" 5. If there are several levels of numbers, ctrl-d and ctrl-t could
"    be used to insert the next number in sequence at the indent level
"    your cursor is in.
" 6. Hit ctrl-g to remove the inserted number
" 7. Hit ctrl-l to forcefully autonumber
"
"Number format expected: "\<\(\d\+\|\a\)\>\W "
" In words: <word-boundary><(numerals or alphabets)><non-word-char><space>
" eg: "1. ",     "32) ",         "a] ",     "D> "
"
" keymappings: ENTER, ctrl-d, ctrl-t, ctlr-l & ctrl-g all in insert mode
"  \as   : To start AutoNumbering
"  \as   : To stop AutoNumbering (yeah, it toggles :)
"  ENTER : start with next number (add 1 to previous)
"  ctrl-d: indent one level back and try to autonumber
"  ctrl-t: indent one level forward and try to autonumber
"  ctrl-l: autonumber.
"  ctrl-g: remove numbering on the line
 
install details
drop it under ~/.vim/plugin
OR
:source autonum.vim
inside vim session
 

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
autonum.vim 2.0 2008-10-23 7.0 Arun E A complete rewrite, this one supports alphabets too as numbered list!
autonum.vim 1.00 2003-03-09 6.0 Arun E Initial upload
ip used for rating: 3.17.128.129

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.
   
Vim at Github