On Tue, Sep 11, 2012 at 2:34 PM, John Beckett <johnb.beckett@gmail.com> wrote:
> Dotan Cohen wrote:
>> I am trying to create a 1,000,000 byte file with VIM. The
>> following has VIM using 100% of _both_ my CPUs (Intel
>> DuoCore) for almost two hours before I killed it:
>> ia<esc>1000000.
>
> Vim is for editing text, not performing arbitrary operations.
> One problem with the above (on a normal Vim, if no special
> commands have been entered first), is that Vim will try to
> maintain an undo list.
>
That is a good point. I didn't even think about the undo list.
However, I must mention that only CPU was swamped, the memory usage
was not noticeably affected.
> Nevertheless, it is possible to have Vim quickly write a file
> consisting of a single line of one million 'a' characters:
>
> :call writefile([repeat('a', 1000000)], 'a.tmp', 'b')
>
> The 'b' option (binary) means there is no newline at the end.
> Omit ", 'b'" if a newline is wanted.
>
Nice. thanks!
--
Dotan Cohen
http://gibberish.co.il
http://what-is-what.com
--
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
Tuesday, September 11, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment