commit 0b43b51d7785aeb4002b45ca49cea5aef0d2e988 (tree)
parent 5dcf8a01756f30b8a6fae07c8db5580e8ce69af5
Author: Daniel Hahler <git@thequod.de>
Date: Wed, 3 Dec 2014 00:35:18 +0100
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -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