Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gx freezes vim if browser is not already open #2

Open
astier opened this issue May 30, 2021 · 6 comments
Open

gx freezes vim if browser is not already open #2

astier opened this issue May 30, 2021 · 6 comments

Comments

@astier
Copy link
Contributor

astier commented May 30, 2021

System

  • gx-extended commit a88e9b6
  • NVIM v0.5.0-dev+1354-ga282a177d
  • Mozilla Firefox 88.0.1

Problem

If the browser is not already open and gx is used to open a link then the browser opens with the correct site, however vim freezes until the browser is closed. If the browser is already open before executing gx then it works as expected and vim doesn't freeze.

vimrc

cal plug#begin($XDG_DATA_HOME.'/nvim/plugins')
    Plug 'stsewd/gx-extended.vim'
cal plug#end()

Reproduce

  1. Close browser
  2. Open vimrc with vim
  3. Move cursor over Plug 'stsewd/gx-extended.vim'
  4. Type gx
@stsewd
Copy link
Owner

stsewd commented Jun 1, 2021

Hi, what OS are you using? I'm not able to replicate it with fedora 34. Also, does this also happens when using the default gx implementation (without this plugin press gx over a full url like https://github.com)

@astier
Copy link
Contributor Author

astier commented Jun 1, 2021

Arch Linux. Native gx doesn't work. I set let g:netrw_browsex_viewer= "xdg-open". It tries do download something. Opens a new buffer. Sometimes it shows the download url in the browser but its not the proper website.

Opening the same website with xdg-open from the terminal works.

@astier
Copy link
Contributor Author

astier commented Jun 2, 2021

If no firefox window is open and I try to open a website with firefox from the terminal than also firefox doesn't go to the background in the terminal. Basically the terminal 'hangs' with firefox (I don't know the proper terminology) until I press which frees the terminal but also closes the browser.

If a firefox-window is already open than the website simply opens up in a new tab in the already existing firefox-window.

Can it be that you have some kind of firefox-deamon running in the background?
Could you reproduce it in the terminal?

@divramod
Copy link

hey @astier, you found a solution to your problem?

@astier
Copy link
Contributor Author

astier commented Feb 15, 2022

No.

@UnkwUsr
Copy link

UnkwUsr commented Apr 20, 2024

I made hacky solution:

let g:gxext#opencmd = '/bin/sh -c "your-browser \"\$1\" & disown" sh'

(replace your-browser with your browser name)

How it works: main thing to make browser starting in background is & disown part. But as plugin expands opencmd variable into <opencmd> <url>, we needed to make such opencmd command which accepts url as very latest argument (because we have no placeholders like %s in C, if you know...). So here is /bin/sh -c ... hack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants