chrishrb / gx.nvim

Implementation of gx without the need of netrw
Apache License 2.0
186 stars 19 forks source link

'gx' blocks NeoVim on Linux #1

Closed andrewferrier closed 1 year ago

andrewferrier commented 1 year ago

On Linux, the standard behaviour of xdg-open is to block, which means that when gx.nvim uses os.execute to call this and open a URL, the whole of the NeoVim interface blocks. This is actually quite annoying if you're for example looking up a URL to copy some text into it, or compare with a file, or somesuch. (On Mac, this doesn't happen).

You might instead want to consider using vim.fn.jobstart to run the process, with detach = true, which, although xdg-open will block, won't block NeoVim itself by running it in the background. This is what I did in my own config for gx until recently when gx.nvim came along. You can find an example of how I implemented it here: https://github.com/andrewferrier/dotfiles/blob/6e8e16c6faa6f3a3f5789e03d30c2e8efa254063/common/.config/nvim/plugin/improve-gx.lua#L5 (ignore the open-file script, that's a wrapper I have around opening files/URLs - imagine it's xdg-open instead).

Really enjoying using gx.nvim, thanks for the great plugin!

chrishrb commented 1 year ago

should be solved now, if the issue still exists reopen this issue 👍

andrewferrier commented 1 year ago

@chrishrb perfect, yes works well! Thank you very much for the fast response and your hard work on this plugin.