knowledge-database (beta)

Current group: comp.editors

[Vim] [Help] Insert sequential number automatically in column?

[Vim] [Help] Insert sequential number automatically in column?  
york
 Re: [Vim] [Help] Insert sequential number automatically in column?  
Sven Guckes
From:york
Subject:[Vim] [Help] Insert sequential number automatically in column?
Date:5 Jan 2005 01:35:33 -0800
Dear all vimer:

I very often do the edit similar to the following:

addr addr0
addr addr1
addr after editting addr2
addr -----------> addr3
addr addr4
addr addr5
addr addr6
addr addr7

I want to write a macro to do it automaticlly.
But I don't know how to write the macro.
I hope my macro can function as following:
step1: Select a column in any length
X
X
X
X
X
X
step2: Excute my macro AutoSequenceNumber(3)
3: beginning number
then the selected column will become
3
4
5
6
7
8

How do I write the macro?
Or are there any better way to do this?

Thanks in advance!
From:Sven Guckes
Subject:Re: [Vim] [Help] Insert sequential number automatically in column?
Date:5 Jan 2005 12:05:02 GMT
* york [2005-01-05]:
> I very often do the edit similar to the following:
>
> addr addr0
> addr addr1
> addr after editting addr2
> addr -----------> addr3
> addr addr4
> addr addr5
> addr addr6
> addr addr7
>
> I want to write a macro to do it automaticlly.

this comes up at least twice a day on this group now, so..

> Or are there any better way to do this?

... *read* the posts here.

Sven
   

Copyright © 2006 knowledge-database   -   All rights reserved