Victor Hsieh wrote:
On 10/6/06, Charles E Campbell Jr <[EMAIL PROTECTED]> wrote:
Victor Hsieh wrote:
> With vim 7.0 and netrw.vim version 98,  I've encountered a problem
> when trying to "vim http://somewhere/file.txt";.  This patch will fix
> the problem:
This would silently let users overwrite their own work that they had not
saved.
I don't think this would be a good idea.
In this case, explicitly open the url via "vim http://..."; can  be
detected, and there's no more risk.  I suppose this is a possible
solution :)

Netrw uses the trailing slash to determine whether to browse the remote
directory
or to bring it up for editing.  Consider  ftp://hostname/some/directory/
-- that trailing
slash tells netrw to display directory contents, not attempt to edit a
file called "directory".

Now, http://... normally uses wget, and there's no corresponding wput;
hence, "editing"
an http://... url is a read-only operation.   So, if one tries to edit a
"directory" with the
http protocol (ie. wget), netrw does the best it can and brings it up
using ftp.  Of course,
ftp is a read and write capable protocol, so one can really edit it.
I know.  But I just want to read the html code or so with my favoriate
editor ;)  I used to do it with vim6.  Actually in most case,
connecting to ftp://somewhere (when open http://somewhere) is not
gonna work.

Regards,
Chip Campbell

Regards,
Vicotr


        http://www.example.com/something/

gives you (usually) the default file in the specified directory. Depending on how the http server is configured, you could get anything. Far from always a directory listing: e.g., on user sites at my ISP (Belgacom Skynet), if there is a file named index.html, INDEX.HTML, index.htm or INDEX.HTM you get that, and if there isn't you are redirected to some Skynet portal. Try the following:

        http://users.skynet.be/antoine.mechelynck/
                you get index.htm (my Welcome page) but the headers don't
                say so
        http://users.skynet.be/antoine.mechelynck/other/
                you are redirected first to a page asking you to choose
                French or Dutch language, and then to the Skynet homepage
        http://users.skynet.be/antoine.mechelynck/other/imbecile.htm
                you get a "real" HTML page, with "Idiots annoy me" in
                a variety of languages (i.e. the directory exists).

OTOH,

        ftp://www.example.com/something/

(when given to a browser) gives you an FTP directory listing of directory /something/ at the FTP site www.example.com (provided that there is an FTP server at that address). Depending on the server, anonymous FTP may or may not be possible.


Best regards,
Tony.

Reply via email to