diff options
Diffstat (limited to 'src/nvim/main.c')
| -rw-r--r-- | src/nvim/main.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index 62500066e9..08e741b3a7 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -197,6 +197,7 @@ void early_init(mparm_T *paramp) estack_init(); cmdline_init(); eval_init(); // init global variables + set_vim_var_nr(VV_STARTTIME, (varnumber_T)os_hrtime()); init_path(argv0 ? argv0 : "nvim"); init_normal_cmds(); // Init the table of Normal mode commands. runtime_init(); @@ -763,7 +764,12 @@ void getout(int exitval) set_vim_var_type(VV_EXITING, VAR_NUMBER); set_vim_var_nr(VV_EXITING, exitval); - // Invoked all deferred functions in the function stack. + // Set v:exitreason if not already set (e.g. by :restart). + if (*get_vim_var_str(VV_EXITREASON) == NUL) { + set_vim_var_string(VV_EXITREASON, S_LEN("quit")); + } + + // Invoked all ":defer" functions in the function stack. invoke_all_defer(); // Optionally print hashtable efficiency. |
