Work around autowrite bug when :terminal is open

This commit is contained in:
Tim Pope
2019-06-25 04:18:19 -04:00
parent a0815c7010
commit fc529da8ae

View File

@@ -857,7 +857,9 @@ function! s:ExpandVar(other, var, flags, esc) abort
endfunction endfunction
function! s:Expand(rev) abort function! s:Expand(rev) abort
if a:rev =~# '^:[0-3]$' if a:rev =~# '^:0'
call s:throw('Use ' . string(':%') . ' instead of ' . string(a:rev))
elseif a:rev =~# '^:[1-3]$'
call s:throw('Use ' . string(a:rev . ':%') . ' instead of ' . string(a:rev)) call s:throw('Use ' . string(a:rev . ':%') . ' instead of ' . string(a:rev))
elseif a:rev =~# '^@{' || a:rev =~# '^\^[0-9~^{]\|^\~[0-9~^]\|^\^$' elseif a:rev =~# '^@{' || a:rev =~# '^\^[0-9~^{]\|^\~[0-9~^]\|^\^$'
call s:throw('Use ' . string('!' . a:rev . ':%') . ' instead of ' . string(a:rev)) call s:throw('Use ' . string('!' . a:rev . ':%') . ' instead of ' . string(a:rev))
@@ -2943,7 +2945,18 @@ function! s:Merge(cmd, bang, mods, args, ...) abort
else else
let &l:makeprg = 'env GIT_EDITOR=false ' . substitute(&l:makeprg, '^env ', '', '') let &l:makeprg = 'env GIT_EDITOR=false ' . substitute(&l:makeprg, '^env ', '', '')
endif endif
try
if !has('patch-8.1.0334') && &autowrite
let autowrite_was_set = 1
set noautowrite
wall
endif
silent noautocmd make! silent noautocmd make!
finally
if exists('autowrite_was_set')
set autowrite
endif
endtry
catch /^Vim\%((\a\+)\)\=:E211/ catch /^Vim\%((\a\+)\)\=:E211/
let err = v:exception let err = v:exception
finally finally
@@ -3453,7 +3466,18 @@ function! s:Dispatch(bang, args)
if exists(':Make') == 2 if exists(':Make') == 2
Make Make
else else
try
if !has('patch-8.1.0334') && &autowrite
let autowrite_was_set = 1
set noautowrite
wall
endif
silent noautocmd make! silent noautocmd make!
finally
if exists('autowrite_was_set')
set autowrite
endif
endtry
redraw! redraw!
return 'call fugitive#Cwindow()|call fugitive#ReloadStatus()' return 'call fugitive#Cwindow()|call fugitive#ReloadStatus()'
endif endif