From df3ac9d278c13e06888e0270ae7296377ec05ee7 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 5 Feb 2020 14:37:54 -0500 Subject: [PATCH] Enable opening arbitrary URLs with :Gbrowse This is still doing a lot of unnecessary processing looking for a remote, but it doesn't seem to hurt anything. --- autoload/fugitive.vim | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 5a8af93..7ccc70e 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -5497,6 +5497,9 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo let type = 'blob' endif let path = path[1:-1] + elseif full =~? '^\a\a\+:[\/][\/]' + let path = s:Slash(full) + let type = 'url' elseif empty(s:Tree(dir)) let path = '.git/' . full[strlen(dir)+1:-1] let type = '' @@ -5635,13 +5638,17 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo \ 'line1': line1, \ 'line2': line2} - let url = '' - for Handler in get(g:, 'fugitive_browse_handlers', []) - let url = call(Handler, [copy(opts)]) - if !empty(url) - break - endif - endfor + if type ==# 'url' + let url = path + else + let url = '' + for Handler in get(g:, 'fugitive_browse_handlers', []) + let url = call(Handler, [copy(opts)]) + if !empty(url) + break + endif + endfor + endif if empty(url) call s:throw("No Gbrowse handler installed for '".raw."'")