mirror of
https://github.com/tpope/vim-fugitive.git
synced 2026-01-01 00:53:28 +08:00
Trigger User FugitiveChanged on events that change repository
Note that in the context of this event, Fugitive functions will use the changed repository, which might not be the same as the current buffer's repository. Pass bufnr() as the optional dir argument to force the current buffer. Closes https://github.com/tpope/vim-fugitive/issues/458
This commit is contained in:
@@ -10,6 +10,9 @@ let g:loaded_fugitive = 1
|
||||
|
||||
function! FugitiveGitDir(...) abort
|
||||
if !a:0 || type(a:1) == type(0) && a:1 < 0
|
||||
if exists('g:fugitive_event')
|
||||
return g:fugitive_event
|
||||
endif
|
||||
let dir = get(b:, 'git_dir', '')
|
||||
if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|prompt\)$')
|
||||
return FugitiveExtractGitDir(getcwd())
|
||||
|
||||
Reference in New Issue
Block a user