mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-08 11:33:47 -05:00
Compare commits
4 Commits
http_githu
...
buffer_pat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2723a1116f | ||
|
|
7df3a6894a | ||
|
|
6f380fa8c6 | ||
|
|
f64ba46509 |
@@ -122,7 +122,7 @@ that are part of Git repositories).
|
||||
|
||||
:{range}Gread! [args] |:read| the output of a Git command after {range}.
|
||||
|
||||
*fugitive-:Gwrite*
|
||||
*fugitive-:Gw* *fugitive-:Gwrite*
|
||||
:Gwrite Write to the current file's path and stage the results.
|
||||
When run in a work tree file, it is effectively git
|
||||
add. Elsewhere, it is effectively git-checkout. A
|
||||
@@ -203,7 +203,7 @@ that are part of Git repositories).
|
||||
To use with GitHub FI, point g:fugitive_github_domains
|
||||
at a list of domains:
|
||||
>
|
||||
let g:fugitive_github_domains = ['git.example.com']
|
||||
let g:fugitive_github_domains = ['https://example.com']
|
||||
~
|
||||
:[range]Gbrowse! Like :Gbrowse, but put the URL on the clipboard rather
|
||||
than opening it.
|
||||
|
||||
@@ -506,9 +506,9 @@ function! s:buffer_path(...) dict abort
|
||||
let rev = matchstr(self.spec(),'^fugitive://.\{-\}//\zs.*')
|
||||
if rev != ''
|
||||
let rev = s:sub(rev,'\w*','')
|
||||
elseif self.repo().bare()
|
||||
elseif self.spec()[0 : len(self.repo().dir())] ==# self.repo().dir() . '/'
|
||||
let rev = '/.git'.self.spec()[strlen(self.repo().dir()) : -1]
|
||||
else
|
||||
elseif !self.repo().bare() && self.spec()[0 : len(self.repo().tree())] ==# self.repo().tree() . '/'
|
||||
let rev = self.spec()[strlen(self.repo().tree()) : -1]
|
||||
endif
|
||||
return s:sub(s:sub(rev,'.\zs/$',''),'^/',a:0 ? a:1 : '')
|
||||
@@ -1870,14 +1870,19 @@ endfunction
|
||||
function! s:github_url(repo,url,rev,commit,path,type,line1,line2) abort
|
||||
let path = a:path
|
||||
let domain_pattern = 'github\.com'
|
||||
for domain in exists('g:fugitive_github_domains') ? g:fugitive_github_domains : []
|
||||
let domain_pattern .= '\|' . escape(domain, '.')
|
||||
let domains = exists('g:fugitive_github_domains') ? g:fugitive_github_domains : []
|
||||
for domain in domains
|
||||
let domain_pattern .= '\|' . escape(split(domain, '://')[-1], '.')
|
||||
endfor
|
||||
let repo = matchstr(a:url,'^\%(https\=://\|git://\|git@\)\zs\('.domain_pattern.'\)[/:].\{-\}\ze\%(\.git\)\=$')
|
||||
if repo ==# ''
|
||||
return ''
|
||||
endif
|
||||
let root = 'https://' . s:sub(repo,':','/')
|
||||
if index(domains, 'http://' . matchstr(repo, '^[^:/]*')) >= 0
|
||||
let root = 'http://' . s:sub(repo,':','/')
|
||||
else
|
||||
let root = 'https://' . s:sub(repo,':','/')
|
||||
endif
|
||||
if path =~# '^\.git/refs/heads/'
|
||||
let branch = a:repo.git_chomp('config','branch.'.path[16:-1].'.merge')[11:-1]
|
||||
if branch ==# ''
|
||||
|
||||
Reference in New Issue
Block a user