Don't work in gvim
araslanov-e opened this issue · 3 comments
After install, opening vim, using :Gbrowse .. nothing.
Ah. Can confirm. Does not work in gvim
. I kept trying to figure out what I was missing in my .vimrc
.
Fugitive (not Rhubarb) opens the URL by invoking :call netrw#BrowseX('https://...', 0)
. If that command works for you but :Gbrowse
doesn't, open an issue on Fugitive. If neither works, that's between you and netrw.
Replying here for the solution. My guess is both @araslanov-e and myself are using something around Vim 7.4 (which is what my CentOS box has). The answer can be found in a bugfix @tpope figured out in tpope/vim-rails#172. In Vim 7.4, autoload/netrw.vim
has:
elseif has("unix") && executable("xdg-open") && !s:haskdeinit
" call Decho("unix and xdg-open")
" call Decho("exe sil !xdg-open ".shellescape(fname,1)." ".redir)
exe "sil !xdg-open ".shellescape(fname,1).redir
let ret= v:shell_error
Per the issue, we can open a la nohup in a couple of ways. First, as @tpope did:
exe "sil !xdg-open ".shellescape(fname,1).redir." &"
Or we can look at how (some versions?) of Vim 8.0 does this:
exe "sil !setsid xdg-open ".shellescape(fname,1).redir
Unfortunately, I don't know enough vimscript to figure out how to override just this one bit of netrw inside of ~/.vimrc
so I had to actually hack the autoload/netrw.vim
file in the installation.