aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-11-14 10:19:06 -0500
committerJames McCoy <jamessan@jamessan.com>2016-11-14 14:16:40 -0500
commit9d2985ecba47968c54590203e89a6614e61020d3 (patch)
treec1cc92ede29aea398c9c1f1ae2072fa201a2ae72 /src
parent4539d867d491c9ca748f3d2de505092c4769824d (diff)
downloadrneovim-9d2985ecba47968c54590203e89a6614e61020d3.tar.gz
rneovim-9d2985ecba47968c54590203e89a6614e61020d3.tar.bz2
rneovim-9d2985ecba47968c54590203e89a6614e61020d3.zip
vim-patch:7.4.1658
Problem: A plugin does not know when VimEnter autocommands were already triggered. Solution: Add the v:vim_did_enter variable. https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval.c1
-rw-r--r--src/nvim/eval.h1
-rw-r--r--src/nvim/main.c1
-rw-r--r--src/nvim/testdir/test_alot.vim1
-rw-r--r--src/nvim/testdir/test_autocmd.vim8
-rw-r--r--src/nvim/version.c2
6 files changed, 13 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 5d4241c8af..b8173c7570 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -384,6 +384,7 @@ static struct vimvar {
VV(VV_NULL, "null", VAR_SPECIAL, VV_RO),
VV(VV__NULL_LIST, "_null_list", VAR_LIST, VV_RO),
VV(VV__NULL_DICT, "_null_dict", VAR_DICT, VV_RO),
+ VV(VV_VIM_DID_ENTER, "vim_did_enter", VAR_NUMBER, VV_RO),
};
#undef VV
diff --git a/src/nvim/eval.h b/src/nvim/eval.h
index d6800afd52..1ab908deb5 100644
--- a/src/nvim/eval.h
+++ b/src/nvim/eval.h
@@ -124,6 +124,7 @@ typedef enum {
VV_NULL,
VV__NULL_LIST, // List with NULL value. For test purposes only.
VV__NULL_DICT, // Dictionary with NULL value. For test purposes only.
+ VV_VIM_DID_ENTER,
} VimVarIndex;
/// All recognized msgpack types
diff --git a/src/nvim/main.c b/src/nvim/main.c
index ffd9353252..159ea03162 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -511,6 +511,7 @@ int main(int argc, char **argv)
if (p_im)
need_start_insertmode = TRUE;
+ set_vim_var_nr(VV_VIM_DID_ENTER, 1L);
apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf);
TIME_MSG("VimEnter autocommands");
diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim
index 87c1cd2c58..60f264fb3f 100644
--- a/src/nvim/testdir/test_alot.vim
+++ b/src/nvim/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_ex_undo.vim
source test_expr.vim
diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim
new file mode 100644
index 0000000000..12c984888e
--- /dev/null
+++ b/src/nvim/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/nvim/version.c b/src/nvim/version.c
index a51c2b6ea9..c1459466a2 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -786,7 +786,7 @@ static int included_patches[] = {
// 1661 NA
// 1660,
// 1659 NA
- // 1658,
+ 1658,
// 1657 NA
// 1656,
// 1655 NA