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.
This commit is contained in:
Tim Pope
2021-03-25 22:54:50 -04:00
parent 0713b84f97
commit a12e88bcc2

View File

@@ -2542,7 +2542,7 @@ augroup fugitive_job
autocmd BufDelete * call s:RunBufDelete(expand('<abuf>'))
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',