loading .vimrc files, executing the "-c cmd"
arguments, creating all windows and loading
the buffers in them.
- *VimLeave*
+ Just before this event is triggered the
+ |v:vim_did_enter| variable is set, so that you
+ can do: >
+ if v:vim_did_enter
+ call s:init()
+ else
+ au VimEnter * call s:init()
+ endif
+< *VimLeave*
VimLeave Before exiting Vim, just after writing the
.viminfo file. Executed only once, like
VimLeavePre.
version 5.0 and 5.1 may have a patch 123, but these are
completely different.
+ *v:vim_did_enter* *vim_did_enter-variable*
+v:vim_did_enter Zero until most of startup is done. It is set to one just
+ before |VimEnter| autocommands are triggered.
+
*v:warningmsg* *warningmsg-variable*
v:warningmsg Last given warning message. It's allowed to set this variable.
{VV_NAME("true", VAR_SPECIAL), VV_RO},
{VV_NAME("null", VAR_SPECIAL), VV_RO},
{VV_NAME("none", VAR_SPECIAL), VV_RO},
+ {VV_NAME("vim_did_enter", VAR_NUMBER), VV_RO},
};
/* shorthand */
if (p_im)
need_start_insertmode = TRUE;
+#ifdef FEAT_EVAL
+ set_vim_var_nr(VV_VIM_DID_ENTER, 1L);
+#endif
#ifdef FEAT_AUTOCMD
apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf);
TIME_MSG("VimEnter autocommands");
" This makes testing go faster, since Vim doesn't need to restart.
source test_assign.vim
+source test_autocmd.vim
source test_cursor_func.vim
source test_delete.vim
source test_ex_undo.vim
--- /dev/null
+" Tests for autocommands
+
+func Test_vim_did_enter()
+ call assert_false(v:vim_did_enter)
+
+ " This script will never reach the main loop, can't check if v:vim_did_enter
+ " becomes one.
+endfunc
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1658,
/**/
1657,
/**/
#define VV_TRUE 64
#define VV_NULL 65
#define VV_NONE 66
-#define VV_LEN 67 /* number of v: vars */
+#define VV_VIM_DID_ENTER 67
+#define VV_LEN 68 /* number of v: vars */
/* used for v_number in VAR_SPECIAL */
#define VVAL_FALSE 0L