Support GitHub FI
This commit is contained in:
parent
4f7af188fe
commit
41ea90cddf
@ -186,6 +186,11 @@ that are part of Git repositories).
|
|||||||
"git instaweb" from a terminal). If a range is given,
|
"git instaweb" from a terminal). If a range is given,
|
||||||
it is appropriately appended to the URL as an anchor.
|
it is appropriately appended to the URL as an anchor.
|
||||||
|
|
||||||
|
To use with GitHub FI, point g:fugitive_github_domains
|
||||||
|
at a list of domains:
|
||||||
|
>
|
||||||
|
let g:fugitive_github_domains = ['git.example.com']
|
||||||
|
~
|
||||||
:[range]Gbrowse! Like :Gbrowse, but put the URL on the clipboard rather
|
:[range]Gbrowse! Like :Gbrowse, but put the URL on the clipboard rather
|
||||||
than opening it.
|
than opening it.
|
||||||
|
|
||||||
|
@ -1758,11 +1758,15 @@ endfunction
|
|||||||
|
|
||||||
function! s:github_url(repo,url,rev,commit,path,type,line1,line2) abort
|
function! s:github_url(repo,url,rev,commit,path,type,line1,line2) abort
|
||||||
let path = a:path
|
let path = a:path
|
||||||
let repo_path = matchstr(a:url,'^\%(https\=://\|git://\|git@\)github\.com[/:]\zs.\{-\}\ze\%(\.git\)\=$')
|
let domain_pattern = 'github\.com'
|
||||||
if repo_path ==# ''
|
for domain in exists('g:fugitive_github_domains') ? g:fugitive_github_domains : []
|
||||||
|
let domain_pattern .= '\|' . escape(domain, '.')
|
||||||
|
endfor
|
||||||
|
let repo = matchstr(a:url,'^\%(https\=://\|git://\|git@\)\zs\('.domain_pattern.'\)[/:].\{-\}\ze\%(\.git\)\=$')
|
||||||
|
if repo ==# ''
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
let root = 'https://github.com/' . repo_path
|
let root = 'https://' . s:sub(repo,':','/')
|
||||||
if path =~# '^\.git/refs/heads/'
|
if path =~# '^\.git/refs/heads/'
|
||||||
let branch = a:repo.git_chomp('config','branch.'.path[16:-1].'.merge')[11:-1]
|
let branch = a:repo.git_chomp('config','branch.'.path[16:-1].'.merge')[11:-1]
|
||||||
if branch ==# ''
|
if branch ==# ''
|
||||||
|
Loading…
Reference in New Issue
Block a user