Expand % instead of <amatch> in the Buf* autocommands

This is relevant in case a previous BufReadPost autocmd changes the file
name using `:file` - fugitive should use the new/current name then.
This commit is contained in:
Daniel Hahler
2014-12-03 00:35:18 +01:00
committed by Tim Pope
parent 5dcf8a0175
commit 0b43b51d77

View File

@@ -220,7 +220,7 @@ endfunction
augroup fugitive
autocmd!
autocmd BufNewFile,BufReadPost * call fugitive#detect(expand('<amatch>:p'))
autocmd BufNewFile,BufReadPost * call fugitive#detect(expand('%: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