9

I use vim in the terminal as well as gvim. My issue is that in the terminal gx opens urls without a problem but in gVim nothing happens.

Has anyone else experienced this issue and found a fix?

I'm using gvim 7.4 with patches 1-52.

statox
  • 49,782
  • 19
  • 148
  • 225
moorej
  • 193
  • 4
  • 2
    I don't know if it is relevant but maybe you should precise which OS you're using. Also I have the same behavior on a Debian with gVim 7.4. – statox Oct 08 '15 at 20:21

2 Answers2

9

I just tried this on a debian with XFCE desktop environment and I can reproduce the issue. Turns out, that gvim calls xdg-open URL to open the URL, but unfortunately, this did not return anything or display an error message.

However, I could fix this, by using setsid xdg-open which you need to set for the g:netrw

:let g:netrw_browsex_viewer="setsid xdg-open"

Bug opened with XFCE

Christian Brabandt
  • 25,820
  • 1
  • 52
  • 77
  • Thanks for this. I'm on Ubuntu with Gnome so I made a slight change: let g:netrw_browsex_viewer="setsid gnome-open" – moorej Oct 08 '15 at 21:35
  • 4
    Could you please explain why setsid fixes the problem? Thanks! – Vitor Oct 09 '15 at 14:53
  • Same happens on Ubuntu 17.10 GNOME. – Ciro Santilli OurBigBook.com Nov 28 '17 at 05:45
  • Ubuntu 18.04: When I use the setting with setsid it pulls the html doc into the gvim window. When I use let g:netrw_browsex_viewer= "gnome-open" just a screen flicker no browser. When I use gnome-open from bash works fine, so what's the problem with Ubuntu gnome? – John Aug 25 '18 at 17:17
0

I'm on OS X and running the following command in vim worked for me:

let g:netrw_browser_viewer='open'
jtpereyda
  • 101
  • 2