diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 0581067..953e72e 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -1767,7 +1767,7 @@ endfunction " }}}1 " Gbrowse {{{1 -call s:command("-bar -bang -count=0 -nargs=? -complete=customlist,s:EditComplete Gbrowse :execute s:Browse(0,,,)") +call s:command("-bar -bang -range -nargs=? -complete=customlist,s:EditComplete Gbrowse :execute s:Browse(0,,,)") function! s:Browse(bang,line1,count,...) abort try @@ -1849,7 +1849,7 @@ function! s:Browse(bang,line1,count,...) abort let url = s:github_url(s:repo(),raw,rev,commit,path,type,a:line1,a:count) if url == '' - let url = s:instaweb_url(s:repo(),rev,commit,path,type,a:count ? a:line1 : 0) + let url = s:instaweb_url(s:repo(),rev,commit,path,type,a:count > 0 ? a:line1 : 0) endif if url == '' @@ -1907,9 +1907,9 @@ function! s:github_url(repo,url,rev,commit,path,type,line1,line2) abort let url = s:sub(root . '/tree/' . commit . '/' . path,'/$','') elseif a:type == 'blob' let url = root . '/blob/' . commit . '/' . path - if a:line2 && a:line1 == a:line2 + if a:line2 > 0 && a:line1 == a:line2 let url .= '#L' . a:line1 - elseif a:line2 + elseif a:line2 > 0 let url .= '#L' . a:line1 . '-' . a:line2 endif elseif a:type == 'tag'