From a12e88bcc260945462909bd4825c1c41f4bcb5d7 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 25 Mar 2021 22:54:50 -0400 Subject: [PATCH] Add error message when editing after Vim exit I don't think it's possible to see this, but we can use this error delivery system for other purposes. --- autoload/fugitive.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 341adcb..2245ac0 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -2542,7 +2542,7 @@ augroup fugitive_job autocmd BufDelete * call s:RunBufDelete(expand('')) autocmd VimLeave * \ for s:jobbuf in keys(s:edit_jobs) | - \ call writefile([], s:edit_jobs[s:jobbuf][0].file . '.exit') | + \ call writefile(['Aborting edit due to Vim exit.'], s:edit_jobs[s:jobbuf][0].file . '.exit') | \ redraw! | \ call call('s:RunWait', remove(s:edit_jobs, s:jobbuf)) | \ endfor @@ -2706,7 +2706,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort \ 'escape': ''} let env.FUGITIVE = state.file let editor = 'sh ' . s:TempScript( - \ '[ -f "$FUGITIVE.exit" ] && exit 1', + \ '[ -f "$FUGITIVE.exit" ] && cat "$FUGITIVE.exit" >&2 && exit 1', \ 'echo "$1" > "$FUGITIVE.edit"', \ 'printf "\033]51;fugitive:edit\007" >&2', \ 'while [ -f "$FUGITIVE.edit" -a ! -f "$FUGITIVE.exit" ]; do sleep 0.05 2>/dev/null || sleep 1; done',