thebishop wrote: > Is VIM capable of replacing matching text with a number that > increments with each match? > > For instance: > > case %match: > case %match: > case %match: > case %match: > > Becomes: > > case 1: > case 2: > case 3: > case 4: > case 5: > Several others have given a function+substitute solution; here's one using visincr:
case 1: (duplicate as needed) (use ctrl-v motion to select the 1s in a column) :I You can get visincr from: http://mysite.verizon.net/astronaut/vim/index.html#VISINCR (cutting edge) http://vim.sourceforge.net/scripts/script.php?script_id=670 (stable) There's a lot of other incrementing/decrementing commands there besides :I... Quick overview: :I [#] left justified incremented list :II [# [zfill]] right justified incremented list :IO [#] left justified octal incremented list :IIO [# [zfill]] right justified octal incremented list :IX [#] left justified hex. incremented lsit :IIX [# [zfill]] right justified hex. incremented lsit :IYMD [# [zfill]] year/month/day incremented list :IMDY [# [zfill]] month/day/year incremented list :IDMY [# [zfill]] day/month/year incremented list :IA [#] alphameric incremented list :ID [#] dayname incremented list :IM [#] monthname incremented list (things line up with a fixed font) Regards, Chip Campbell --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---