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') let fn = expand('%:p')
silent exe 'doau BufReadPre '.s:fnameescape(fn) silent exe 'doau BufReadPre '.s:fnameescape(fn)
silent exe 'keepalt file '.temp silent exe 'keepalt file '.temp
let modelines = &modelines
try try
set modelines=0
if a:0 if a:0
silent noautocmd edit! silent noautocmd edit!
else else
silent edit! silent edit!
endif endif
finally finally
let &modelines = modelines
try try
silent exe 'keepalt file '.s:fnameescape(fn) silent exe 'keepalt file '.s:fnameescape(fn)
catch /^Vim\%((\a\+)\)\=:E302:/ catch /^Vim\%((\a\+)\)\=:E302:/