Re: inserting line numbers programmatically
- * Benji Fisher <benji@...> [2003-11-01 22:50]:
> On Sat, Nov 01, 2003 at 07:55:34PM -0330, Neil Zanella wrote:Here is a link to another thread that is related to doing this. It's
> > Hello,
> > I have a text file with N lines. I would like to issue a command such that
> > the lines become prefixed with:
> > LINE1
> > LINE2
> > LINE3
> > LINE4
> > LINE5
> > ...
> > Is this possible with vim? I know there are commands starting with q used
> > to record other commands but I am not sure whether it is possible to make
> > reference to a counter initialized to one and increment the counter from
> > within vim so as to produce the above effect.
> :%s/^/\= "LINE" . line(".")
> :help sub-replace-special
> There are also several scripts that make this sort of thing easier and
> more flexible. I have not tried them myself, but a search for scripts
> with the keyword "number"
> shows increment.vim and visincr.vim among others.
from earlier posts to this list:
- On Sat, Nov 01, 2003 at 07:55:34PM -0330, Neil Zanella wrote:
> I have a text file with N lines. I would like to issue a command such that...
> the lines become prefixed with:
One may use
to see line numbers (they're not actually made part of the file)
or you could use <visincr.vim> for this.
as "Visual Incrementing".
Charles E Campbell, Jr, PhD _ __ __
Goddard Space Flight Center / /_/\_\_/ /
cec@... /_/ \/_//_/
PGP public key: http://www.erols.com/astronaut/pgp.html