summaryrefslogtreecommitdiff
path: root/runtime
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 /runtime
parent23515b4ef7580af8b9d3b964a558ab2007cacda5 (diff)
downloadvim-git-f0068c5154a99b86b2c4515a4b93c003b2445cf4.tar.gz
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 'runtime')
-rw-r--r--runtime/doc/autocmd.txt2
-rw-r--r--runtime/doc/eval.txt7
2 files changed, 9 insertions, 0 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index c35e89907..ea9a220cd 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -1214,6 +1214,7 @@ VimLeave Before exiting Vim, just after writing the
To detect an abnormal exit use |v:dying|.
When v:dying is 2 or more this event is not
triggered.
+ To get the exit code use |v:exiting|.
*VimLeavePre*
VimLeavePre Before exiting Vim, just before writing the
.viminfo file. This is executed only once,
@@ -1224,6 +1225,7 @@ VimLeavePre Before exiting Vim, just before writing the
< To detect an abnormal exit use |v:dying|.
When v:dying is 2 or more this event is not
triggered.
+ To get the exit code use |v:exiting|.
*VimResized*
VimResized After the Vim window was resized, thus 'lines'
and/or 'columns' changed. Not when starting
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 72a66d548..6f594ab81 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1850,6 +1850,13 @@ v:dying Normally zero. When a deadly signal is caught it's set to
< Note: if another deadly signal is caught when v:dying is one,
VimLeave autocommands will not be executed.
+ *v:exiting* *exiting-variable*
+v:exiting Vim exit code. Normally zero, non-zero when something went
+ wrong. The value is v:null before invoking the |VimLeavePre|
+ and |VimLeave| autocmds. See |:q|, |:x| and |:cquit|.
+ Example: >
+ :au VimLeave * echo "Exit value is " .. v:exiting
+<
*v:echospace* *echospace-variable*
v:echospace Number of screen cells that can be used for an `:echo` message
in the last screen line before causing the |hit-enter-prompt|.