> I want to paste a string that contains a number like "value1".
>
> Each time I paste I want to increment the number.
> The ultimate goal is something like 50p to do this 50 times.
> (value1\nvalue2\nvalue3...)
>
> I thought about pasting it 50 times first and run over the pasted
> lines with some cool regex, but I failed doing so.
You've found a plugin to do it anyway, but failing that, the cool
regex would be something like this:
First paste 50 copes of the line "valueX" then run
:let i=1
:g/X/s//\=i/|let i+=1
(As described by John Little, message #3 here:
http://groups.google.com/group/vim_use/tree/browse_frm/month/2011-04/b03722a98dcae38c?rnum=81&_done=%2Fgroup%2Fvim_use%2Fbrowse_frm%2Fmonth%2F2011-04%3F)
That doesn't quite work how you described it. If being able to
do something like "50p" is important I'd use a recording.
e.g. type these commands
:let i=1
qq
ivalue<Ctrl-R>=i<Enter><Enter><Escape>
:let i+= 1
q
then you can run 49@q to play it back to get 50 lines.
You can read up with ":help recording"
regards,
Geoff
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment