netrw#BrowseX fails when invoked from gvim on Ubuntu

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

netrw#BrowseX fails when invoked from gvim on Ubuntu

Garvin Haslett
I am using Vim 8.2 on Ubuntu 18.04.3

If I launch gvim and enter 

:call netrw#BrowseX('http://github.com', 0) 

the window flickers instantaneously and nothing further happens.

Performing the same action in terminal vim opens the URL in the browser as expected.

It seems likely that this is an issue with how Gnome hands this off to Linux. But where do I begin to prove this?

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/9e6f3b77-8875-4ca0-8d0f-529bcf5bcb79%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: netrw#BrowseX fails when invoked from gvim on Ubuntu

Garvin Haslett
No answer, so I suppose this question isn't regarded as relevant.
Can anyone point me somewhere I can ask gvim specific questions?

On Thursday, 5 March 2020 02:35:30 UTC, Garvin Haslett wrote:
I am using Vim 8.2 on Ubuntu 18.04.3

If I launch gvim and enter 

:call netrw#BrowseX('<a href="http://github.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fgithub.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFCNLSjW9vNIlZmNtEh3Pi8fjEOSw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fgithub.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFCNLSjW9vNIlZmNtEh3Pi8fjEOSw&#39;;return true;">http://github.com', 0) 

the window flickers instantaneously and nothing further happens.

Performing the same action in terminal vim opens the URL in the browser as expected.

It seems likely that this is an issue with how Gnome hands this off to Linux. But where do I begin to prove this?

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/df02e88c-5526-42fa-b70e-89eba9966697%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: netrw#BrowseX fails when invoked from gvim on Ubuntu

Christian Brabandt

On Di, 10 Mär 2020, Garvin Haslett wrote:

> No answer, so I suppose this question isn't regarded as relevant.
> Can anyone point me somewhere I can ask gvim specific questions?

The list is correct, however perhaps nobody knows an answer to your
problem?

If you don't mind debugging netrw, have a look at `:h netrw-debug`
or try to manually step through the commands using
`:debug :call netrw#BrowseX(...)`
(see for a brief help `:h :debug`)

My guess is, netrw calls xdg-open, which calls a script depending on
your desktop-environment something like `exo-open` or `gnome-open` and
some of those commands returns an error (or is not installed).

Best,
Christian

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200310093608.GJ9229%40256bit.org.
Reply | Threaded
Open this post in threaded view
|

Re: netrw#BrowseX fails when invoked from gvim on Ubuntu

Charles Campbell-2
In reply to this post by Garvin Haslett
Garvin Haslett wrote:

> I am using Vim 8.2 on Ubuntu 18.04.3
>
> If I launch gvim and enter
>
> :call netrw#BrowseX('http://github.com', 0)
>
> the window flickers instantaneously and nothing further happens.
>
> Performing the same action in terminal vim opens the URL in the
> browser as expected.
>
> It seems likely that this is an issue with how Gnome hands this off to
> Linux. But where do I begin to prove this?
>
Well, here's two issues:

1) netrw requires a trailing "/", so you need 'http://github.com/' . 
Didn't you get an error message at the bottom of the display?
2) unless you're hosting github.com on your personal pc, you probably
want "remote"

When I tried this with gx with the cursor atop the (corrected)
http://github.com/ string, I got the html source as expected; that's
with Scientific Linux.
So, as Christian Brabandt said, use netrw's debug mode and find out what
its doing on your system.  If doing like I did (with gx) works, then run
debugging with that, too, and compare.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/8c1f491f-7d93-9810-f4c8-78e5e7396a7e%40drchip.org.
Reply | Threaded
Open this post in threaded view
|

Re: netrw#BrowseX fails when invoked from gvim on Ubuntu

Garvin Haslett
In reply to this post by Christian Brabandt
On Tuesday, 10 March 2020 09:37:06 UTC, Christian Brabandt wrote:


If you don't mind debugging netrw, have a look at `:h netrw-debug`
or try to manually step through the commands using
`:debug :call netrw#BrowseX(...)`
(see for a brief help `:h :debug`)

My guess is, netrw calls xdg-open, which calls a script depending on
your desktop-environment something like `exo-open` or `gnome-open` and
some of those commands returns an error (or is not installed).


I don't mind at all. The first step of the process (invoking vim/gvim without other plugins) confirmed that we see the same behaviour outlined in my original message, i.e., vim invoked from the command line successfully sends the URL to chrome while gvim does not. 

Attached is the Decho output produced by the call using gvim.

The key lines seem to be:

|s:NetrwExe(a:cmd<sil !xdg-open 'http://github.com/'>/dev/null 2>&1>) {
||exe sil !xdg-open 'http://github.com/'>/dev/null 2>&1 ~10
||return s:NetrwExe : v:shell_error=0 }

which, to my (untrained) eye looks like a successful call.
Am I correct?

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/757948f6-57e3-4844-b94e-b623d8acb7e7%40googlegroups.com.

netrw_gvim.dbg (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: netrw#BrowseX fails when invoked from gvim on Ubuntu

Garvin Haslett
I worked it out finally, this is a known issue with how gvim handles shell commands:
https://superuser.com/questions/386646/xdg-open-url-doesnt-open-the-website-in-my-default-browser

In short netrw#BrowseX does invoke a call to xdg-open which command line vim deals with as expected.
It seems that gvim spawns some sort of temporary process which is then killed instantaneously; thus preventing the request from making it to the browser. 

On Thursday, 12 March 2020 22:16:05 UTC, Garvin Haslett wrote:
On Tuesday, 10 March 2020 09:37:06 UTC, Christian Brabandt wrote:


If you don't mind debugging netrw, have a look at `:h netrw-debug`
or try to manually step through the commands using
`:debug :call netrw#BrowseX(...)`
(see for a brief help `:h :debug`)

My guess is, netrw calls xdg-open, which calls a script depending on
your desktop-environment something like `exo-open` or `gnome-open` and
some of those commands returns an error (or is not installed).


I don't mind at all. The first step of the process (invoking vim/gvim without other plugins) confirmed that we see the same behaviour outlined in my original message, i.e., vim invoked from the command line successfully sends the URL to chrome while gvim does not. 

Attached is the Decho output produced by the call using gvim.

The key lines seem to be:

|s:NetrwExe(a:cmd<sil !xdg-open '<a href="http://github.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fgithub.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHS3e-N1GF2AlPstOWxKYoPPi2Zig&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fgithub.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHS3e-N1GF2AlPstOWxKYoPPi2Zig&#39;;return true;">http://github.com/'>/dev/null 2>&1>) {
||exe sil !xdg-open '<a href="http://github.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fgithub.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHS3e-N1GF2AlPstOWxKYoPPi2Zig&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fgithub.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHS3e-N1GF2AlPstOWxKYoPPi2Zig&#39;;return true;">http://github.com/'>/dev/null 2>&1 ~10
||return s:NetrwExe : v:shell_error=0 }

which, to my (untrained) eye looks like a successful call.
Am I correct?

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/ad49df8c-9859-4005-80f5-32bc5c0ece6e%40googlegroups.com.