Expose Cmd autocommand functions

This commit is contained in:
Tim Pope 2018-05-30 01:06:29 -04:00
parent 8977570aa6
commit d850dff16e

View File

@ -845,7 +845,7 @@ function! fugitive#ReloadStatus() abort
endif endif
try try
if !&modified if !&modified
call s:BufReadIndex() call fugitive#BufReadStatus()
endif endif
finally finally
if exists('restorewinnr') if exists('restorewinnr')
@ -2589,7 +2589,7 @@ function! s:ReplaceCmd(cmd,...) abort
endtry endtry
endfunction endfunction
function! s:BufReadIndex() abort function! fugitive#BufReadStatus() abort
if !exists('b:fugitive_display_format') if !exists('b:fugitive_display_format')
let b:fugitive_display_format = filereadable(expand('%').'.lock') let b:fugitive_display_format = filereadable(expand('%').'.lock')
endif endif
@ -2669,7 +2669,7 @@ function! s:BufReadIndex() abort
endtry endtry
endfunction endfunction
function! s:FileRead() abort function! fugitive#FileRead() abort
try try
let repo = s:repo(FugitiveExtractGitDir(expand('<amatch>'))) let repo = s:repo(FugitiveExtractGitDir(expand('<amatch>')))
let path = s:sub(s:sub(matchstr(expand('<amatch>'),'fugitive://.\{-\}//\zs.*'),'/',':'),'^\d:',':&') let path = s:sub(s:sub(matchstr(expand('<amatch>'),'fugitive://.\{-\}//\zs.*'),'/',':'),'^\d:',':&')
@ -2686,7 +2686,7 @@ function! s:FileRead() abort
endtry endtry
endfunction endfunction
function! s:BufReadIndexFile() abort function! fugitive#BufReadIndex() abort
try try
let b:fugitive_type = 'blob' let b:fugitive_type = 'blob'
let b:git_dir = s:repo().dir() let b:git_dir = s:repo().dir()
@ -2707,7 +2707,7 @@ function! s:BufReadIndexFile() abort
endtry endtry
endfunction endfunction
function! s:BufWriteIndexFile() abort function! fugitive#BufWriteIndex() abort
let tmp = tempname() let tmp = tempname()
try try
let path = matchstr(expand('<amatch>'),'//\d/\zs.*') let path = matchstr(expand('<amatch>'),'//\d/\zs.*')
@ -2740,7 +2740,7 @@ function! s:BufWriteIndexFile() abort
endtry endtry
endfunction endfunction
function! s:BufReadObject() abort function! fugitive#BufReadObject() abort
try try
setlocal noro ma setlocal noro ma
let b:git_dir = s:repo().dir() let b:git_dir = s:repo().dir()
@ -2828,16 +2828,16 @@ augroup fugitive_files
autocmd! autocmd!
autocmd BufReadCmd index{,.lock} autocmd BufReadCmd index{,.lock}
\ if FugitiveIsGitDir(expand('<amatch>:p:h')) | \ if FugitiveIsGitDir(expand('<amatch>:p:h')) |
\ exe s:BufReadIndex() | \ exe fugitive#BufReadStatus() |
\ elseif filereadable(expand('<amatch>')) | \ elseif filereadable(expand('<amatch>')) |
\ read <amatch> | \ read <amatch> |
\ 1delete | \ 1delete |
\ endif \ endif
autocmd FileReadCmd fugitive://**//[0-3]/** exe s:FileRead() autocmd FileReadCmd fugitive://**//[0-3]/** exe fugitive#FileRead()
autocmd BufReadCmd fugitive://**//[0-3]/** exe s:BufReadIndexFile() autocmd BufReadCmd fugitive://**//[0-3]/** exe fugitive#BufReadIndex()
autocmd BufWriteCmd fugitive://**//[0-3]/** exe s:BufWriteIndexFile() autocmd BufWriteCmd fugitive://**//[0-3]/** exe fugitive#BufWriteIndex()
autocmd BufReadCmd fugitive://**//[0-9a-f][0-9a-f]* exe s:BufReadObject() autocmd BufReadCmd fugitive://**//[0-9a-f][0-9a-f]* exe fugitive#BufReadObject()
autocmd FileReadCmd fugitive://**//[0-9a-f][0-9a-f]* exe s:FileRead() autocmd FileReadCmd fugitive://**//[0-9a-f][0-9a-f]* exe fugitive#FileRead()
autocmd FileType git autocmd FileType git
\ if exists('b:git_dir') | \ if exists('b:git_dir') |
\ call s:JumpInit() | \ call s:JumpInit() |