summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-11-30 17:42:10 +0100
committerBram Moolenaar <Bram@vim.org>2020-11-30 17:42:10 +0100
commitf0068c5154a99b86b2c4515a4b93c003b2445cf4 (patch)
tree18198d6cb57c407acaddf8c7ed8b62a41fed2805 /src/main.c
parent23515b4ef7580af8b9d3b964a558ab2007cacda5 (diff)
patch 8.2.2070: can't get the exit value in VimLeave(Pre) autocommandsv8.2.2070
Problem: Can't get the exit value in VimLeave or VimLeavePre autocommands. Solution: Add v:exiting like in Neovim. (Yegappan Lakshmanan, closes #7395)
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index e3ce9e4a60..1b7811a670 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1505,7 +1505,8 @@ getout_preserve_modified(int exitval)
/*
- * Exit properly.
+ * Exit properly. This is the only way to exit Vim after startup has
+ * succeeded. We are certain to exit here, no way to abort it.
*/
void
getout(int exitval)
@@ -1521,6 +1522,11 @@ getout(int exitval)
if (exmode_active)
exitval += ex_exitval;
+#ifdef FEAT_EVAL
+ set_vim_var_type(VV_EXITING, VAR_NUMBER);
+ set_vim_var_nr(VV_EXITING, exitval);
+#endif
+
// Position the cursor on the last screen line, below all the text
#ifdef FEAT_GUI
if (!gui.in_use)