:GBrowse is giving Netrw not found. Define your own :Browse to use :GBrowse since netrw is disabled by telescope.nvim.

I tried to define :Browse like this:

:command! -nargs=1 Browse !open <args>

but it does not work properly when using :GBrowse with ranges like :.GBrowse or :'<,'>GBrowse, because the url will contain # and it will try to expand it to the alternate filename (:h alternate-file, :h c_#). The expansion fails with E194: No alternate file name to substitute for '#': !open https://github.com/xxx/yyy#L3

How can I define a :Browse that works for :GBrowse in all cases?


2 Answers 2


For those who want a pure Lua solution in neovim, here is a Lua version of @RubenLaguna solution:

  function (opts)
    vim.fn.system { 'xdg-open', opts.fargs[1] }
  { nargs = 1 }

Using xdg-open as the external command will work with most Linux distributions. Mac OS users use open instead and Windows users would use start to achieve the same.


The following :Browse definition works when using :GBrowse with ranges:

:command! -nargs=1 Browse silent execute '!open' shellescape(<q-args>,1)

Relevant help pages: :h :!, :h shellescape(), :h :execute and :h :silent)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.