Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
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 '12 at 18:39
    
The only difference is vim_env has TERM=xterm, gvim_env TERM=dumb –  Maxim Kim Feb 6 '12 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 '12 at 20:02
    
I'm afraid I'm stumped then. Sorry I couldn't help. –  garyjohn Feb 6 '12 at 20:46

2 Answers 2

up vote 6 down vote accepted

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

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

share|improve this answer
1  
I had a similar problem here: stackoverflow.com/q/15880689/152439. Since your answer helped me, feel free to answer my question, and I'll accept. –  andreas-h Apr 8 '13 at 15:03
    
Can anyone explain why this works and the original not? –  Ciro Santilli Jun 17 at 10:33

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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