netrw on windows+shellslash

119 views
Skip to first unread message

mattn

unread,
Oct 7, 2015, 10:13:13 PM10/7/15
to vim_dev, NdrO...@scampbellpfamily.abizm
Hi.

I wrote a patch to enable http/ftp/webdav access with netrw on windows+shellslash. I'm using vim but not use cygwin or msys2. However, then editing http file on vim, URL is displayed as:

http:\\example.com\foo.html

So I want to use shellslash on windows too. Below is a patch to enable this.

https://gist.github.com/mattn/0799137eea35ed4e789d

Bram, I'm having one more idea to avoid this. It's keeping slash when the buffer name seems to be URL. How do you think?

- mattn

mattn

unread,
Oct 8, 2015, 12:20:03 AM10/8/15
to vim_dev, drc...@campbellfamily.biz
Sorry, I miss e-mail address of Dr. Chip.

Charles Campbell

unread,
Oct 8, 2015, 1:44:36 PM10/8/15
to vim...@googlegroups.com
Hello, Mattn:

Would you just please send me the diff/patch directly? You can find my
email address at the top of the netrw.vim plugin file.

Unless you can tell me how to get the diff off that github page...

Regards,
Chip Campbell

Nikolay Pavlov

unread,
Oct 8, 2015, 3:51:52 PM10/8/15
to vim_dev
There is “Raw” button in the top-right corner of the file contents
pointing to https://gist.github.com/mattn/0799137eea35ed4e789d/raw/eab15794ee2302a9ac371ff4971f56eb243896f9/gistfile1.diff.

>
> Regards,
> Chip Campbell
>
> --
> --
> You received this message from the "vim_dev" 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
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Charles Campbell

unread,
Oct 8, 2015, 4:00:07 PM10/8/15
to vim...@googlegroups.com
Nikolay Pavlov wrote:
> 2015-10-08 20:44 GMT+03:00 Charles Campbell <Charles.E...@nasa.gov>:
>> mattn wrote:
>>> Hi.
>>>
>>> I wrote a patch to enable http/ftp/webdav access with netrw on windows+shellslash. I'm using vim but not use cygwin or msys2. However, then editing http file on vim, URL is displayed as:
>>>
>>> http:\\example.com\foo.html
>>>
>>> So I want to use shellslash on windows too. Below is a patch to enable this.
>>>
>>> https://gist.github.com/mattn/0799137eea35ed4e789d
>>>
>>> Bram, I'm having one more idea to avoid this. It's keeping slash when the buffer name seems to be URL. How do you think?
>>>
>> Hello, Mattn:
>>
>> Would you just please send me the diff/patch directly? You can find my
>> email address at the top of the netrw.vim plugin file.
>>
>> Unless you can tell me how to get the diff off that github page...
> There is “Raw” button in the top-right corner of the file contents
> pointing to https://gist.github.com/mattn/0799137eea35ed4e789d/raw/eab15794ee2302a9ac371ff4971f56eb243896f9/gistfile1.diff.
>
Thank you, I think I've got it now.

Hmm, unfortunately I've got 28 out of 58 failed hunks. I don't think I
can use this. Mattn -- please get the latest netrw from
http://www.drchip.org/astronaut/vim/index.html#NETRW and try modifying that

Regards,
Chip Campbell

Bram Moolenaar

unread,
Oct 10, 2015, 2:50:24 PM10/10/15
to mattn, vim_dev, NdrO...@scampbellpfamily.abizm
How will the resulting buffer name, with the slash, be used?
Is this only inside netrw? In that case you'll have to talk to
Charles.

--
This planet has -- or rather had -- a problem, which was this: most
of the people living on it were unhappy for pretty much of the time.
Many solutions were suggested for this problem, but most of these
were largely concerned with the movements of small green pieces of
paper, which is odd because on the whole it wasn't the small green
pieces of paper that were unhappy.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Yasuhiro MATSUMOTO

unread,
Oct 10, 2015, 9:19:05 PM10/10/15
to Bram Moolenaar, vim_dev, NdrO...@scampbellpfamily.abizm
No. patching vim. if okay, will make a patch.
--
- Yasuhiro Matsumoto

mattn

unread,
Oct 11, 2015, 12:29:48 PM10/11/15
to vim_dev, Br...@moolenaar.net, NdrO...@scampbellpfamily.abizm
On Sunday, October 11, 2015 at 10:19:05 AM UTC+9, mattn wrote:
> > How will the resulting buffer name, with the slash, be used?
> > Is this only inside netrw? In that case you'll have to talk to
> > Charles.

> No. patching vim. if okay, will make a patch.

There are two problem.

1. ":e http://www.google.com/" doesn't work on noshellslash.
2. URL is displayed as http:\\www.google.com\foo.html

1 should be fixed with my previous patch. I will update in later.
2 should be following patch.

diff --git a/src/fileio.c b/src/fileio.c
index 0f3f148..b4480d0 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -7555,6 +7555,8 @@ forward_slash(fname)
{
char_u *p;

+ if (path_with_url(fname))
+ return;
for (p = fname; *p != NUL; ++p)
# ifdef FEAT_MBYTE
/* The Big5 encoding can have '\' in the trail byte. */
diff --git a/src/os_win32.c b/src/os_win32.c
index 5114863..3c6cdbe 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -2731,6 +2731,8 @@ fname_case(
flen = (int)STRLEN(name);
if (flen == 0)
return;
+ if (path_with_url(name))
+ return;

slash_adjust(name);

mattn

unread,
Oct 11, 2015, 12:42:29 PM10/11/15
to vim_dev, Charles.E...@nasa.gov
Hi, Dr. Chip.

updated patch. could you please download patch file from following. sorry google groups doesn't work correctly for attachment files.

https://gist.githubusercontent.com/mattn/97270d911ee142daa66c/raw/c40e9acdad70d372918cf47f4b59e04a0fe0eae9/netrw-shellslash.diff

Regards.
- mattn

mattn

unread,
Oct 11, 2015, 12:45:06 PM10/11/15
to vim_dev, Br...@moolenaar.net, NdrO...@scampbellpfamily.abizm
> 2 should be following patch.
>
> diff --git a/src/fileio.c b/src/fileio.c
> index 0f3f148..b4480d0 100644
> --- a/src/fileio.c
> +++ b/src/fileio.c
> @@ -7555,6 +7555,8 @@ forward_slash(fname)
> {
> char_u *p;
>
> + if (path_with_url(fname))
> + return;
> for (p = fname; *p != NUL; ++p)
> # ifdef FEAT_MBYTE
> /* The Big5 encoding can have '\' in the trail byte. */
> diff --git a/src/os_win32.c b/src/os_win32.c
> index 5114863..3c6cdbe 100644
> --- a/src/os_win32.c
> +++ b/src/os_win32.c
> @@ -2731,6 +2731,8 @@ fname_case(
> flen = (int)STRLEN(name);
> if (flen == 0)
> return;
> + if (path_with_url(name))
> + return;
>
> slash_adjust(name);

seems still not. :e works fine but

C:\>vim http://www.google.com/index.html

This doesn't work.

mattn

unread,
Oct 11, 2015, 12:52:27 PM10/11/15
to vim_dev, Br...@moolenaar.net, NdrO...@scampbellpfamily.abizm

Fixed.

diff --git a/src/fileio.c b/src/fileio.c
index 0f3f148..b4480d0 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -7555,6 +7555,8 @@ forward_slash(fname)
{
char_u *p;

+ if (path_with_url(fname))
+ return;
for (p = fname; *p != NUL; ++p)
# ifdef FEAT_MBYTE
/* The Big5 encoding can have '\' in the trail byte. */

diff --git a/src/os_mswin.c b/src/os_mswin.c
index b50b86c..29a1491 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -486,6 +486,8 @@ mch_isFullName(char_u *fname)
slash_adjust(p)
char_u *p;
{
+ if (path_with_url(p))
+ return;
while (*p)
{
if (*p == psepcN)

Bram Moolenaar

unread,
Oct 11, 2015, 4:39:55 PM10/11/15
to mattn, vim_dev, Br...@moolenaar.net, NdrO...@scampbellpfamily.abizm

Yasuhiro Matsumoto wrote:

> On Sunday, October 11, 2015 at 10:19:05 AM UTC+9, mattn wrote:
> > > How will the resulting buffer name, with the slash, be used?
> > > Is this only inside netrw? In that case you'll have to talk to
> > > Charles.
>
> > No. patching vim. if okay, will make a patch.
>
> There are two problem.
>
> 1. ":e http://www.google.com/" doesn't work on noshellslash.
> 2. URL is displayed as http:\\www.google.com\foo.html
>
> 1 should be fixed with my previous patch. I will update in later.
> 2 should be following patch.

Thanks, I'll look into it soon.


--
hundred-and-one symptoms of being an internet addict:
29. Your phone bill comes to your doorstep in a box.
Reply all
Reply to author
Forward
0 new messages