6

I am using gvim 7.3.401 on archlinux. The shell command :!xdg-open http://www.vim.org doesn't open my default browser with that link. In fact, it appears to do nothing.

This works as expected within terminal vim

How can I make it work in gvim too?

4
  • Both work fine for me on a Fedora 11 system, in that they both open that URL in Konqueror, although they both print an error message like this one: "<unknown program name>(25702)/ ClientApp::doIt: Creating ClientApp". Perhaps your environments differ between vim and gvim. Try executing ":!env > gvim_env" in gvim and ":!env > vim_env" in vim, then in the shell execute "vimdiff gvim_env vim_env" to see the differences. You may have to sort those files as well for the diff to make sense.
    – garyjohn
    Feb 6, 2012 at 18:39
  • The only difference is vim_env has TERM=xterm, gvim_env TERM=dumb
    – Maxim Kim
    Feb 6, 2012 at 19:47
  • It works on my debian squeeze box with gnome2, but not on my laptop with archlinux and gnome3
    – Maxim Kim
    Feb 6, 2012 at 20:02
  • I'm afraid I'm stumped then. Sorry I couldn't help.
    – garyjohn
    Feb 6, 2012 at 20:46

2 Answers 2

9

Try :!xdg-open http://www.vim.org &

I had the same issue until I saw how LaTeX-Box does it.

2
2

The issue here is that gvim does spawn a new, dummy terminal for each command and it apparently kills it after the command returns. So the:

:!xdg-open http://www.vim.org

returns immediately and apparently(*) the xdg-open internal asynchronous call to X gets terminated, while making the call go to background (as suggested by sappjw) doesn't:

:!xdg-open http://www.vim.org &

(*) - please correct me if I'm wrong

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.