mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -376,7 +376,7 @@ function! fugitive#repo(...) abort
|
||||
endif
|
||||
return extend(repo, s:repo_prototype, 'keep')
|
||||
endif
|
||||
call s:throw('not a git repository: '.expand('%:p'))
|
||||
call s:throw('not a Git repository: ' . string(dir))
|
||||
endfunction
|
||||
|
||||
function! s:repo_dir(...) dict abort
|
||||
@ -400,19 +400,19 @@ function! s:repo_bare() dict abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:repo_route(object) dict abort
|
||||
return fugitive#Route(a:object, self.git_dir)
|
||||
function! s:repo_find(object) dict abort
|
||||
return fugitive#Find(a:object, self.git_dir)
|
||||
endfunction
|
||||
|
||||
function! s:repo_translate(rev) dict abort
|
||||
return s:Slash(fugitive#Route(substitute(a:rev, '^/', ':(top)', ''), self.git_dir))
|
||||
return s:Slash(fugitive#Find(substitute(a:rev, '^/', ':(top)', ''), self.git_dir))
|
||||
endfunction
|
||||
|
||||
function! s:repo_head(...) dict abort
|
||||
return fugitive#Head(a:0 ? a:1 : 0, self.git_dir)
|
||||
endfunction
|
||||
|
||||
call s:add_methods('repo',['dir','tree','bare','route','translate','head'])
|
||||
call s:add_methods('repo',['dir','tree','bare','find','translate','head'])
|
||||
|
||||
function! s:repo_prepare(...) dict abort
|
||||
return call('fugitive#Prepare', [self.git_dir] + a:000)
|
||||
@ -485,8 +485,24 @@ function! s:Owner(path, ...) abort
|
||||
return ''
|
||||
endif
|
||||
let [pdir, commit, file] = s:DirCommitFile(a:path)
|
||||
if s:cpath(dir, pdir) && commit =~# '^\x\{40\}$'
|
||||
return commit
|
||||
if s:cpath(dir, pdir)
|
||||
if commit =~# '^\x\{40\}$'
|
||||
return commit
|
||||
elseif commit ==# '2'
|
||||
return 'HEAD^{}'
|
||||
endif
|
||||
if filereadable(dir . '/MERGE_HEAD')
|
||||
let merge_head = 'MERGE_HEAD'
|
||||
elseif filereadable(dir . '/REBASE_HEAD')
|
||||
let merge_head = 'REBASE_HEAD'
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
if commit ==# '3'
|
||||
return merge_head . '^{}'
|
||||
elseif commit ==# '1'
|
||||
return s:TreeChomp('merge-base', 'HEAD', merge_head, '--')
|
||||
endif
|
||||
endif
|
||||
let path = fnamemodify(a:path, ':p')
|
||||
if s:cpath(dir . '/', path[0 : len(dir)]) && a:path =~# 'HEAD$'
|
||||
@ -565,7 +581,7 @@ function! s:Relative(...) abort
|
||||
return fugitive#Path(@%, a:0 ? a:1 : ':(top)')
|
||||
endfunction
|
||||
|
||||
function! fugitive#Route(object, ...) abort
|
||||
function! fugitive#Find(object, ...) abort
|
||||
if type(a:object) == type(0)
|
||||
let name = bufname(a:object)
|
||||
return s:PlatformSlash(name =~# '^$\|^/\|^\a\+:' ? name : getcwd() . '/' . name)
|
||||
@ -622,7 +638,7 @@ function! fugitive#Route(object, ...) abort
|
||||
else
|
||||
let altdir = FugitiveExtractGitDir(f)
|
||||
if len(altdir) && !s:cpath(dir, altdir)
|
||||
return fugitive#Route(a:object, altdir)
|
||||
return fugitive#Find(a:object, altdir)
|
||||
endif
|
||||
endif
|
||||
elseif rev =~# '^:[0-3]:'
|
||||
@ -654,7 +670,7 @@ function! fugitive#Route(object, ...) abort
|
||||
else
|
||||
let altdir = FugitiveExtractGitDir(file)
|
||||
if len(altdir) && !s:cpath(dir, altdir)
|
||||
return fugitive#Route(a:object, altdir)
|
||||
return fugitive#Find(a:object, altdir)
|
||||
endif
|
||||
return file
|
||||
endif
|
||||
@ -682,7 +698,7 @@ function! s:Generate(rev, ...) abort
|
||||
elseif a:rev =~# '^/' && len(tree) && getftime(tree . a:rev) >= 0 && getftime(a:rev) < 0
|
||||
let object = ':(top)' . a:rev[1:-1]
|
||||
endif
|
||||
return fugitive#Route(object, dir)
|
||||
return fugitive#Find(object, dir)
|
||||
endfunction
|
||||
|
||||
function! s:DotRelative(path) abort
|
||||
@ -1082,7 +1098,7 @@ function! fugitive#buffer(...) abort
|
||||
if buffer.getvar('git_dir') !=# ''
|
||||
return buffer
|
||||
endif
|
||||
call s:throw('not a git repository: '.bufname(buffer['#']))
|
||||
call s:throw('not a Fugitive buffer: ' . string(bufname(buffer['#'])))
|
||||
endfunction
|
||||
|
||||
function! s:buffer_getvar(var) dict abort
|
||||
@ -1500,7 +1516,7 @@ function! fugitive#BufReadCmd(...) abort
|
||||
if lnum
|
||||
silent keepjumps delete_
|
||||
end
|
||||
silent exe (exists(':keeppatterns') ? 'keeppatterns' : '') 'keepjumps 1,/^diff --git\|\%$/g/\r$/s///'
|
||||
silent exe (exists(':keeppatterns') ? 'keeppatterns' : '') 'keepjumps 1,/^diff --git\|\%$/s/\r$//e'
|
||||
keepjumps 1
|
||||
endif
|
||||
elseif b:fugitive_type ==# 'stage'
|
||||
|
@ -43,8 +43,8 @@ function! FugitiveReal(...) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! FugitiveRoute(...) abort
|
||||
return fugitive#Route(a:0 ? a:1 : bufnr(''), FugitiveGitDir(a:0 > 1 ? a:2 : -1))
|
||||
function! FugitiveFind(...) abort
|
||||
return fugitive#Find(a:0 ? a:1 : bufnr(''), FugitiveGitDir(a:0 > 1 ? a:2 : -1))
|
||||
endfunction
|
||||
|
||||
function! FugitivePath(...) abort
|
||||
@ -104,6 +104,8 @@ function! FugitiveTreeForGitDir(path) abort
|
||||
let dir = a:path
|
||||
if dir =~# '/\.git$'
|
||||
return len(dir) ==# 5 ? '/' : dir[0:-6]
|
||||
elseif dir ==# ''
|
||||
return ''
|
||||
endif
|
||||
if !has_key(s:worktree_for_dir, dir)
|
||||
let s:worktree_for_dir[dir] = ''
|
||||
@ -203,12 +205,12 @@ function! FugitiveDetect(path) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! FugitiveFind(...) abort
|
||||
return call('FugitiveRoute', a:000)
|
||||
function! FugitiveRoute(...) abort
|
||||
return call('FugitiveFind', a:000)
|
||||
endfunction
|
||||
|
||||
function! FugitiveGenerate(...) abort
|
||||
return call('FugitiveRoute', a:000)
|
||||
throw 'Use FugitiveFind() instead'
|
||||
endfunction
|
||||
|
||||
function! s:Slash(path) abort
|
||||
@ -258,7 +260,7 @@ augroup fugitive
|
||||
autocmd FileType gitrebase
|
||||
\ let &l:include = '^\%(pick\|squash\|edit\|reword\|fixup\|drop\|[pserfd]\)\>' |
|
||||
\ if exists('b:git_dir') |
|
||||
\ let &l:includeexpr = 'v:fname =~# ''^\x\{4,40\}$'' ? FugitiveRoute(v:fname) : ' .
|
||||
\ let &l:includeexpr = 'v:fname =~# ''^\x\{4,40\}$'' ? FugitiveFind(v:fname) : ' .
|
||||
\ (len(&l:includeexpr) ? &l:includeexpr : 'v:fname') |
|
||||
\ endif |
|
||||
\ let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'exe') . '|setl inex= inc='
|
||||
|
Reference in New Issue
Block a user