On Fri, Oct 10, 2008 at 07:42:05AM -0500, Tim Chase wrote:
> 
> > 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 :)

Indeed!

> 
> > * 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
> 
> 
> 
> > 

A pure Vimscript method that will work on boxes without Perl or seq
(I'm talking about you, WinXP):

:for i in range(1, 100) | exe "put =" i | endfor


-- 
Erik Falor
Registered Linux User #445632 http://counter.li.org

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

Reply via email to