mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -59,8 +59,8 @@ endfunction
|
||||
|
||||
function! FugitiveExtractGitDir(path) abort
|
||||
let path = s:shellslash(a:path)
|
||||
if path =~# '^fugitive://.*//'
|
||||
return matchstr(path, '\C^fugitive://\zs.\{-\}\ze//')
|
||||
if path =~# '^fugitive:'
|
||||
return matchstr(path, '\C^fugitive:\%(//\)\=\zs.\{-\}\ze\%(//\|::\|$\)')
|
||||
elseif isdirectory(path)
|
||||
let path = fnamemodify(path, ':p:s?/$??')
|
||||
else
|
||||
@ -138,6 +138,19 @@ function! FugitiveHead(...) abort
|
||||
return fugitive#repo().head(a:0 ? a:1 : 0)
|
||||
endfunction
|
||||
|
||||
function! FugitivePath(...) abort
|
||||
let file = fnamemodify(a:0 ? a:1 : @%, ':p')
|
||||
if file =~? '^fugitive:'
|
||||
return fugitive#Path(file)
|
||||
else
|
||||
return file
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! FugitiveReal(...) abort
|
||||
return call('FugitivePath', a:000)
|
||||
endfunction
|
||||
|
||||
augroup fugitive
|
||||
autocmd!
|
||||
|
||||
@ -147,6 +160,15 @@ augroup fugitive
|
||||
autocmd VimEnter * if expand('<amatch>')==''|call FugitiveDetect(getcwd())|endif
|
||||
autocmd CmdWinEnter * call FugitiveDetect(expand('#:p'))
|
||||
|
||||
autocmd FileType git
|
||||
\ if exists('b:git_dir') |
|
||||
\ call fugitive#MapJumps() |
|
||||
\ endif
|
||||
autocmd FileType git,gitcommit,gitrebase
|
||||
\ if exists('b:git_dir') |
|
||||
\ call fugitive#MapCfile() |
|
||||
\ endif
|
||||
|
||||
autocmd BufReadCmd index{,.lock}
|
||||
\ if FugitiveIsGitDir(expand('<amatch>:p:h')) |
|
||||
\ exe fugitive#BufReadStatus() |
|
||||
|
Reference in New Issue
Block a user