mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-14 06:13:51 -05:00
Provide error message when Netrw can't be loaded
This commit is contained in:
@@ -5618,7 +5618,7 @@ augroup fugitive_blame
|
||||
autocmd BufWinLeave * execute getwinvar(+bufwinnr(+expand('<abuf>')), 'fugitive_leave')
|
||||
augroup END
|
||||
|
||||
" Section: :Gbrowse
|
||||
" Section: :GBrowse
|
||||
|
||||
let s:redirects = {}
|
||||
|
||||
@@ -5631,7 +5631,7 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo
|
||||
if a:count >= 0
|
||||
return 'echoerr ' . string('fugitive: ''-'' no longer required to get persistent URL if range given')
|
||||
else
|
||||
return 'echoerr ' . string('fugitive: use :0Gbrowse instead of :Gbrowse -')
|
||||
return 'echoerr ' . string('fugitive: use :0GBrowse instead of :GBrowse -')
|
||||
endif
|
||||
elseif len(a:args)
|
||||
let remote = matchstr(join(a:args, ' '),'@\zs\%('.validremote.'\)$')
|
||||
@@ -5822,7 +5822,7 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo
|
||||
endif
|
||||
|
||||
if empty(url)
|
||||
call s:throw("No Gbrowse handler installed for '".raw."'")
|
||||
call s:throw("No GBrowse handler installed for '".raw."'")
|
||||
endif
|
||||
|
||||
let url = s:gsub(url, '[ <>]', '\="%".printf("%02X",char2nr(submatch(0)))')
|
||||
@@ -5833,14 +5833,18 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo
|
||||
return 'echomsg '.string(url)
|
||||
elseif exists(':Browse') == 2
|
||||
return 'echomsg '.string(url).'|Browse '.url
|
||||
elseif exists(':OpenBrowser') == 2
|
||||
return 'echomsg '.string(url).'|OpenBrowser '.url
|
||||
else
|
||||
if !exists('g:loaded_netrw')
|
||||
runtime! autoload/netrw.vim
|
||||
endif
|
||||
if exists('*netrw#BrowseX')
|
||||
return 'echomsg '.string(url).'|call netrw#BrowseX('.string(url).', 0)'
|
||||
else
|
||||
elseif exists('*netrw#NetrwBrowseX')
|
||||
return 'echomsg '.string(url).'|call netrw#NetrwBrowseX('.string(url).', 0)'
|
||||
else
|
||||
return 'echoerr ' . string('Netrw not found. Define your own :Browse to use :GBrowse')
|
||||
endif
|
||||
endif
|
||||
catch /^fugitive:/
|
||||
|
||||
Reference in New Issue
Block a user