From a152894a55344957207cdb8e18e05b8baf2c34b4 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 22 Jul 2019 14:33:06 -0400 Subject: [PATCH] Don't rely on exception message for :Gbrowse - error --- autoload/fugitive.vim | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 9db6f6a..928751c 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -4587,7 +4587,7 @@ endfunction " Section: :Gbrowse -call s:command("-bar -bang -range=0 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse", "Browse") +call s:command("-bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse", "Browse") let s:redirects = {} @@ -4595,7 +4595,13 @@ function! s:BrowseCommand(line1, line2, range, count, bang, mods, reg, arg, args let dir = s:Dir() try let validremote = '\.\|\.\=/.*\|[[:alnum:]_-]\+\%(://.\{-\}\)\=' - if len(a:args) + if a:args ==# ['-'] + 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 -') + endif + elseif len(a:args) let remote = matchstr(join(a:args, ' '),'@\zs\%('.validremote.'\)$') let rev = substitute(join(a:args, ' '),'@\%('.validremote.'\)$','','') else @@ -4793,12 +4799,6 @@ function! s:BrowseCommand(line1, line2, range, count, bang, mods, reg, arg, args return 'echomsg '.string(url).'|call netrw#NetrwBrowseX('.string(url).', 0)' endif endif - catch /^fugitive: Use '!:%' instead of '-'/ - if a:count >= 0 - return 'echoerr ' . string('fugitive: ''-'' no longer required to get persistent URL') - else - return 'echoerr ' . string('fugitive: use :0Gbrowse instead of :Gbrowse -') - endif catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry