> I'm sure others will reply with functions etc to do this, but I tend to go 
> for:

Of course...this is Vim so there regularly a multitude of ways to 
accomplish a goal :)


> * Create a new file
> * Enter '1' on the first line
> * 'yy' (copy first line)
> * '99p' (paste 99 times)
> * Ctrl-V (visual block mode)
> * G$ (select everything)
> * :I (visual increment using Dr Chip's visincr.vim plugin [1])

I case you don't want to bother with plugins (I like to keep my 
vim installs pretty native so I don't start leaning on things 
that aren't baked-in across all the umpteen machines I use), you 
can use

   yy    (yank the initial empty/blank line)
   99p   (paste it 99 more times to get places to put line#s)
   :%s/^/\=line('.')     (to put the current line# on each line)


> Alternatively, just use perl:
> 
> perl -e 'for($i=1;$i<=100;$i++) { print $i . "\n"; }' > filename.txt


Or most *nix boxes have "seq" available:

   :0r! seq 100
   and optionally ":$d"/"Gdd" to delete the last/blank line

:)

-tim



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to