Closed stevearc closed 1 month ago
Netrw brings a bit more to the table than just opening a URL: It also displays an error message if something went wrong. Despite having ui
in the name, vim.ui.open
doesn't concern itself with this UI affordance, or indeed, any other UI at all. We'd need a dozen lines of Lua to achieve the same behavior as Netrw, and I don't want to add a _fugitive.lua
just for that.
As a compromise, I have added support with more limited error handling, but given it a priority below Netrw.
Works for me, thank you!
It is not uncommon for Neovim users to have netrw disabled in favor of other file explorers. When this is the case,
:GBrowse
fails. Neovim 0.10 ships with a new [vim.ui.open](https://neovim.io/doc/user/lua.html#vim.ui.open()) helper method that is designed to replace this exact functionality.This PR simply preferentially uses
vim.ui.open
in Neovim 0.10+ over netrw. I have tested it with a simple:GBrowse
in a file and it appears to work well.