> Hi Phillip!
>
> On Sa, 02 Jan 2010, Phillip Bruce wrote:
>
>> Hi,
>>
>> I have questions about getting vi to add numbers in sequence within a file.
>>
>> So If I have 1000 dummy's and instead of hand typing all this in a file. I
>> wonder if there was
>> an easy to accomplish this using vim.
>>
>> Any suggestions would be helpful.
>
> Another solution, which would only work with vim 7.2 with patch 295
> included uses a little bit scripting:
>
> :let list=repeat(["dummy"], 100)
> :call map(list, 'v:val.printf("%02d",v:key+1)')
> :call append("$", list)
This does the trick in one line, and should work as far back as 7.2.000:
:call append('$', map(range(100), 'printf("dummy%02d", v:val)'))
~Matt
--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment