aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval.c1
-rw-r--r--test/functional/viml/completion_spec.lua7
2 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 6bd2b23c73..93590445c9 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -503,6 +503,7 @@ void eval_init(void)
/* add to compat scope dict */
hash_add(&compat_hashtab, p->vv_di.di_key);
}
+ set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc());
set_vim_var_nr(VV_SEARCHFORWARD, 1L);
set_vim_var_nr(VV_HLSEARCH, 1L);
set_reg_var(0); /* default for v:register is not 0 but '"' */
diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua
index 7fd36c64fa..5e3d4a6658 100644
--- a/test/functional/viml/completion_spec.lua
+++ b/test/functional/viml/completion_spec.lua
@@ -10,6 +10,13 @@ describe('completion', function()
end)
describe('v:completed_item', function()
+ it('is empty dict until completion', function()
+ eq({}, eval('v:completed_item'))
+ end)
+ it('is empty dict if the candidate is not inserted', function()
+ feed('ifoo<ESC>o<C-x><C-n><C-e><ESC>')
+ eq({}, eval('v:completed_item'))
+ end)
it('returns expected dict in normal completion', function()
feed('ifoo<ESC>o<C-x><C-n><ESC>')
eq('foo', eval('getline(2)'))