From fc529da8ae38a66f9a8b3085b1e50a38b8df32c2 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 25 Jun 2019 04:18:19 -0400 Subject: [PATCH] Work around autowrite bug when :terminal is open --- autoload/fugitive.vim | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index bb6a9c0..df3881b 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -857,7 +857,9 @@ function! s:ExpandVar(other, var, flags, esc) abort endfunction 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)) elseif a:rev =~# '^@{' || a:rev =~# '^\^[0-9~^{]\|^\~[0-9~^]\|^\^$' call s:throw('Use ' . string('!' . a:rev . ':%') . ' instead of ' . string(a:rev)) @@ -2943,8 +2945,19 @@ function! s:Merge(cmd, bang, mods, args, ...) abort else let &l:makeprg = 'env GIT_EDITOR=false ' . substitute(&l:makeprg, '^env ', '', '') endif - silent noautocmd make! - catch /^Vim\%((\a\+)\)\=:E211/ + try + if !has('patch-8.1.0334') && &autowrite + let autowrite_was_set = 1 + set noautowrite + wall + endif + silent noautocmd make! + finally + if exists('autowrite_was_set') + set autowrite + endif + endtry + catch /^Vim\%((\a\+)\)\=:E211/ let err = v:exception finally redraw! @@ -3453,7 +3466,18 @@ function! s:Dispatch(bang, args) if exists(':Make') == 2 Make else - silent noautocmd make! + try + if !has('patch-8.1.0334') && &autowrite + let autowrite_was_set = 1 + set noautowrite + wall + endif + silent noautocmd make! + finally + if exists('autowrite_was_set') + set autowrite + endif + endtry redraw! return 'call fugitive#Cwindow()|call fugitive#ReloadStatus()' endif