From d4fb2a2f5c2023f477beae6aef47cf0457351e6e Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 9 Sep 2018 09:34:52 -0400 Subject: [PATCH] Fix modeline support in historical buffers Closes https://github.com/tpope/vim-fugitive/issues/1092 --- autoload/fugitive.vim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 13e0d29..f92bc9a 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1267,7 +1267,7 @@ endfunction " Section: Buffer auto-commands -function! s:ReplaceCmd(cmd) abort +function! s:ReplaceCmd(cmd, ...) abort let temp = tempname() let err = s:TempCmd(temp, a:cmd) if v:shell_error @@ -1278,7 +1278,11 @@ function! s:ReplaceCmd(cmd) abort silent exe 'doau BufReadPre '.s:fnameescape(fn) silent exe 'keepalt file '.temp try - silent noautocmd edit! + if a:0 + silent noautocmd edit! + else + silent edit! + endif finally try silent exe 'keepalt file '.s:fnameescape(fn) @@ -1314,7 +1318,7 @@ function! fugitive#BufReadStatus() abort \ '-c', 'status.short=false', \ 'status'] endif - call s:ReplaceCmd(call('fugitive#Prepare', cmd)) + call s:ReplaceCmd(call('fugitive#Prepare', cmd), 1) if b:fugitive_display_format if &filetype !=# 'git' set filetype=git