commit 0103538d7a8e03c061c031e33459aeaa4cf040ab (tree)
parent a27b899a36eb339a1ed7ec986663835f3bc316e9
Author: Tim Pope <code@tpope.net>
Date: Sat, 23 Feb 2013 12:24:24 -0500
Expose detect interface
Closes #311.
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -133,7 +133,7 @@ function! fugitive#extract_git_dir(path) abort
return ''
endfunction
-function! s:Detect(path)
+function! fugitive#detect(path)
if exists('b:git_dir') && (b:git_dir ==# '' || b:git_dir =~# '/$')
unlet b:git_dir
endif
@@ -162,10 +162,10 @@ endfunction
augroup fugitive
autocmd!
- autocmd BufNewFile,BufReadPost * call s:Detect(expand('<amatch>:p'))
- autocmd FileType netrw call s:Detect(expand('%:p'))
- autocmd User NERDTreeInit,NERDTreeNewRoot call s:Detect(b:NERDTreeRoot.path.str())
- autocmd VimEnter * if expand('<amatch>')==''|call s:Detect(getcwd())|endif
+ autocmd BufNewFile,BufReadPost * call fugitive#detect(expand('<amatch>:p'))
+ autocmd FileType netrw call fugitive#detect(expand('%:p'))
+ autocmd User NERDTreeInit,NERDTreeNewRoot call fugitive#detect(b:NERDTreeRoot.path.str())
+ autocmd VimEnter * if expand('<amatch>')==''|call fugitive#detect(getcwd())|endif
autocmd BufWinLeave * execute getwinvar(+bufwinnr(+expand('<abuf>')), 'fugitive_leave')
augroup END
@@ -2251,7 +2251,7 @@ augroup fugitive_temp
\ if has_key(s:temp_files,expand('<afile>:p')) |
\ let b:git_dir = s:temp_files[expand('<afile>:p')] |
\ let b:git_type = 'temp' |
- \ call s:Detect(expand('<afile>:p')) |
+ \ call fugitive#detect(expand('<afile>:p')) |
\ setlocal bufhidden=delete |
\ nnoremap <buffer> <silent> q :<C-U>bdelete<CR>|
\ endif