Tuesday, September 11, 2012

Re: Create a 1,000,000 byte file with VIM.

On Tue, Sep 11, 2012 at 5:25 PM, Tony Mechelynck
<antoine.mechelynck@gmail.com> wrote:
> I think that the following will create a file containing one million spaces
> (and *no* carriage-return after them). I haven't tested it. It mixes
> ex-commands and normal-mode commands. It assumes that the current file is
> not modified. It will fail (with an error) if the required features are not
> compiled-in. <Space> and <Esc> are one keypress each. It assumes that ^ is a
> valid character in a filename, which is true under Unix/Linux; I don't know
> about Windows.
>
> :enew
> :setlocal virtualedit=all binary noeol
> :set undolevels=0 nobackup nowritebackup
> 1000000|
> i<Space><Esc>
> :saveas 10^6spc.txt
>
> For a million 'a' instead, add
>
> :s/ /a/g
>
> before the :saveas but that :substitute operation may be costly.
>

Thanks, there is much interesting stuff in there. This is quite why I
asked the question!


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

No comments: