Don't process modelines after :Gwrite
Closes https://github.com/tpope/vim-fugitive/issues/956
This commit is contained in:
parent
45ca1eab83
commit
cf9ef7377f
@ -1914,6 +1914,8 @@ function! fugitive#FileWriteCmd(...) abort
|
|||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let s:nomodeline = (v:version >= 704 ? '<nomodeline>' : '')
|
||||||
|
|
||||||
function! fugitive#BufReadCmd(...) abort
|
function! fugitive#BufReadCmd(...) abort
|
||||||
let amatch = a:0 ? a:1 : expand('<amatch>')
|
let amatch = a:0 ? a:1 : expand('<amatch>')
|
||||||
try
|
try
|
||||||
@ -2022,7 +2024,7 @@ function! fugitive#BufReadCmd(...) abort
|
|||||||
endtry
|
endtry
|
||||||
|
|
||||||
setlocal modifiable
|
setlocal modifiable
|
||||||
return 'silent doautocmd' . (v:version >= 704 ? ' <nomodeline>' : '') .
|
return 'silent doautocmd' . s:nomodeline .
|
||||||
\ ' BufReadPost' . (modifiable ? '' : '|setl nomodifiable')
|
\ ' BufReadPost' . (modifiable ? '' : '|setl nomodifiable')
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr ' . string(v:exception)
|
return 'echoerr ' . string(v:exception)
|
||||||
@ -4147,7 +4149,7 @@ function! s:WriteCommand(line1, line2, range, count, bang, mods, reg, arg, args)
|
|||||||
|
|
||||||
unlet! restorewinnr
|
unlet! restorewinnr
|
||||||
let zero = s:Generate(':0:'.file)
|
let zero = s:Generate(':0:'.file)
|
||||||
silent execute 'doautocmd BufWritePost' s:fnameescape(zero)
|
silent execute 'doautocmd' s:nomodeline 'BufWritePost' s:fnameescape(zero)
|
||||||
for tab in range(1,tabpagenr('$'))
|
for tab in range(1,tabpagenr('$'))
|
||||||
for winnr in range(1,tabpagewinnr(tab,'$'))
|
for winnr in range(1,tabpagewinnr(tab,'$'))
|
||||||
let bufnr = tabpagebuflist(tab)[winnr-1]
|
let bufnr = tabpagebuflist(tab)[winnr-1]
|
||||||
|
Loading…
Reference in New Issue
Block a user