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!
On Linux, the standard behaviour of
xdg-open
is to block, which means that whengx.nvim
usesos.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, withdetach = true
, which, althoughxdg-open
will block, won't block NeoVim itself by running it in the background. This is what I did in my own config forgx
until recently whengx.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 theopen-file
script, that's a wrapper I have around opening files/URLs - imagine it'sxdg-open
instead).Really enjoying using
gx.nvim
, thanks for the great plugin!