diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index ca67b57..c5f7046 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -271,14 +271,21 @@ augroup fugitive \ endif | \ let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'exe') . '|setl inex= inc=' + " Handle index files in Git directories, emulating normal sequence of + " autocommands if a file named `index` is found elsewhere: autocmd BufReadCmd index{,.lock} \ if FugitiveIsGitDir(expand(':p:h')) | \ let b:git_dir = s:Slash(expand(':p:h')) | \ exe fugitive#BufReadStatus() | \ elseif filereadable(expand('')) | - \ read | + \ silent doautocmd BufReadPre | + \ keepalt read | \ 1delete_ | + \ silent doautocmd BufReadPost | + \ else | + \ silent doautocmd BufNewFile | \ endif + autocmd BufReadCmd fugitive://*//* exe fugitive#BufReadCmd() autocmd BufWriteCmd fugitive://*//[0-3]/* exe fugitive#BufWriteCmd() autocmd FileReadCmd fugitive://*//* exe fugitive#FileReadCmd()