I was able to reproduce my :!xdg-open problem again, but only inside gvim. It seems to work fine if I do :!xdg-open URL &, though I don't know why. This was the only thing I could find about it:
Does call netrw#NetrwBrowseX('http://google.com', 0) work for you? I think it might be easier to just leverage that.
call netrw#NetrwBrowseX('http://google.com', 0)
Nope, that doesn't seem to do anything either.
Can you try throwing a ; sleep 5 on the end and see if that fixes it? I'm wondering if this is a very different manifestation of tpope/vim-fugitive#351.
; sleep 5
Also, remind me your original solution?
Adding the sleep does fix the problem as well.
It's been a long time, but I believe the problem is related to #166 and OpenURL.
I'm guessing this has to do with the fact that xdg-open calls gvfs-open, and gvfs-open exits immediately, before the underlying browser command is executed, though I'm not sure why that would matter. By contrast, sensible-browser does not exit immediately.
ari@ari:~$ xdg-open http://google.com
ari@ari:~$ Created new window in existing browser session.
ari@ari:~$ sensible-browser http://google.com
Created new window in existing browser session.
It does seem likely that it's another manifestation of that vim-fugitive issue.
Yeah I remember the original issue, but you initially submitted a different patch that has since vanished.
I think I had been using sh -c 'xdg-open ...', but that doesn't seem to work now.
sh -c 'xdg-open ...'
Let me know if you figure it out; I want to try to dissect and generalize it.
I've also been having problems with !xdg-open [...] or !gnome-open [...] in gvim, and appending & works fine for me too. This is a problem when using Netrw, though—I should be able to press x on a file and have it open, but this doesn't work, and (AFAIK) I can't change how Netrw executes files. (I can change the command, but not make it background.) Thoughts, workarounds?
Any reason not to just add the & to the xdg-open command? The underlying issue seems to be that gnome-open or gvfs-open, called by xdg-open, backgrounds itself but GVim closes its fake terminal before gnome-open can finish its business.
I'd actually like to switch to delegating to netrw and wash my hands of the matter, but in the meantime, I'd merge a pull request and see if it helps.
Launch xdg-open in the background
Fixes #172. Works around not working inside GVim.