Tuesday, May 17, 2011

Re: BufReadPost getfsize and scp

David wrote:
> On 3 Mai, 16:48, Charles Campbell<Charles.E.Campb...@nasa.gov> wrote:
>
>> Netrw attempts to minimize the number of times that a password may be
>> needed, so it doesn't attempt to find out what the file size is before
>> getting the file via scp (or ftp).
>>
> So it does not throw any useful events for my case, does it?
>
>
>
>> LargeFile, like DL's example, uses getfsize() to do its automatic
>> large-file determination.
>> However, it does have a "force-it" option: try using :Large!
>> (instead of :Large).
>>
> This works only after I have loaded the file then, correct?
> It does indeed speed up things quite a lot, but I'd prefer a totally
> automatic solution for this.
>
Please try v5h of LargeFile.vim (available at
http://mysite.verizon.net/astronaut/vim/index.html#LARGEFILE).

I haven't tested it using scp/ftp myself, but I've put some code in it
that should:

* uses getfsize(); if the file is large, s:LargeFile() will do its
usual thing (turning off syntax, etc)
* if getfsize() returned -2, then s:LargeFile() will do its usual thing
* if getfsize() returned -1, as generally happens with ftp://.... and
scp://... , then after the file has loaded, it will check if
line2byte(line("$")) is large, and if so, s:LargeFile() will be called
with force to treat it as a large file.

Regards,
Chip Campbell

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