diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-26 21:00:08 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-26 21:00:08 +0100 |
commit | 1473551a4457d4920b235eeeb9f279e196ee7225 (patch) | |
tree | bd0515b263f9f2ea82effe2ef09073512078e838 /src | |
parent | 8fdd7210479f0c486822ad8934087b4bfd8a4765 (diff) | |
download | vim-1473551a4457d4920b235eeeb9f279e196ee7225.zip |
patch 7.4.1658
Problem: A plugin does not know when VimEnter autocommands were already
triggered.
Solution: Add the v:vim_did_enter variable.
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 1 | ||||
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/testdir/test_alot.vim | 1 | ||||
-rw-r--r-- | src/testdir/test_autocmd.vim | 8 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim.h | 3 |
6 files changed, 17 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c index 06f3585b3..c1046955b 100644 --- a/src/eval.c +++ b/src/eval.c @@ -372,6 +372,7 @@ static struct vimvar {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 */ diff --git a/src/main.c b/src/main.c index 35c940f6a..91ef66db6 100644 --- a/src/main.c +++ b/src/main.c @@ -969,6 +969,9 @@ vim_main2(int argc UNUSED, char **argv UNUSED) 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"); diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim index fcf358b53..06309982a 100644 --- a/src/testdir/test_alot.vim +++ b/src/testdir/test_alot.vim @@ -2,6 +2,7 @@ " 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 diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim new file mode 100644 index 000000000..12c984888 --- /dev/null +++ b/src/testdir/test_autocmd.vim @@ -0,0 +1,8 @@ +" 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 diff --git a/src/version.c b/src/version.c index 6459356ce..62e66ab1f 100644 --- a/src/version.c +++ b/src/version.c @@ -749,6 +749,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1658, +/**/ 1657, /**/ 1656, @@ -1869,7 +1869,8 @@ typedef int sock_T; #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 |