Disable modelines while loading blob

Modelines will still be evaluated by `doautocmd BufReadPost`.

References https://github.com/tpope/vim-fugitive/issues/1136
This commit is contained in:
Tim Pope 2018-12-23 14:30:34 -05:00
parent 70170d825c
commit 38c6acf27a

View File

@ -1347,13 +1347,16 @@ function! s:ReplaceCmd(cmd, ...) abort
let fn = expand('%:p')
silent exe 'doau BufReadPre '.s:fnameescape(fn)
silent exe 'keepalt file '.temp
let modelines = &modelines
try
set modelines=0
if a:0
silent noautocmd edit!
else
silent edit!
endif
finally
let &modelines = modelines
try
silent exe 'keepalt file '.s:fnameescape(fn)
catch /^Vim\%((\a\+)\)\=:E302:/