From d1142e02bf943aa40a80e0bdbf0687d65df4dfa2 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 20 Dec 2020 20:26:27 -0500 Subject: vim-patch:8.1.1872: when Vim exits because of a signal, VimLeave is not triggered Problem: When Vim exits because of a signal, VimLeave is not triggered. (Daniel Hahler) Solution: Unblock autocommands when triggering VimLeave. (closes vim/vim#4818) https://github.com/vim/vim/commit/c7226684c82dde7eb6601e067ee2e9387e447903 --- src/nvim/main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/nvim/main.c') diff --git a/src/nvim/main.c b/src/nvim/main.c index fd8264583b..ed055e76ba 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -662,7 +662,17 @@ void getout(int exitval) } if (v_dying <= 1) { + int unblock = 0; + + // deathtrap() blocks autocommands, but we do want to trigger VimLeave. + if (is_autocmd_blocked()) { + unblock_autocmds(); + unblock++; + } apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, false, curbuf); + if (unblock) { + block_autocmds(); + } } profile_dump(); -- cgit