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.
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.
John
--
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