I used to use chromium before and then, I could press gx on an url and vim would open it in a new tab if a chromium instance was already running, otherwise create a new window.

But in firefox, when I press gx on an url, vim opens a new firefox instance that is not even signed into my firefox account.

How do I change the behavior of gx so that it opens a new tab of an already opened firefox instance?

N.B. The output of lsb_release -a is as follows.

enan@elariel:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:    18.04
Codename:   bionic
  • 1
    The launch process is platform-dependent. What OS are you on? – B Layer Feb 29 '20 at 14:28
  • 1
    @BLayer, added OS info in edit. Thanks for helping. – klaus Feb 29 '20 at 16:18
  • 1
    Mostly using Cygwin here now which has different process than pure *nix. I can tell you that the logic for launching external progs (e.g. browser) is in the function netrw#BrowseX in $VIMRUNTIME/autoload/netrw.vim (long function...scroll down a ways). Looks like xdgopen is used in some cases. Anyways, you might want to poke around there yourself...see if you see anything off. – B Layer Feb 29 '20 at 17:33
  • 1
    this depends on your desktop environment. I believe netrw does simply call xdg-open. What browser this finally opens depends on the default browser for your desktop environment. On XFCE, this uses e.g. exo-open. I suppose you have to configure it using some desktop files. (on my system, it opens URLs in a new tab of firefox). – Christian Brabandt Feb 29 '20 at 21:40
  • @ChristianBrabandt, I just did exo-open "https://google.com" from my terminal. It opened in a new-tab. But vim doesn't do that. Something else is wrong. I'm looking through netrw.vim and its help docs(huge!) to see if I can find something. Will report back if I do. – klaus Mar 1 '20 at 14:15

Your Answer

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

Browse other questions tagged or ask your own question.