diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2015-05-02 09:19:19 +0900 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-05-24 17:05:12 -0400 |
commit | d9f97e3026983863d70cbae670bf8277143c8434 (patch) | |
tree | 3634f90a5fc71d0376b6687cdb027aa458fe287a /src/nvim/edit.c | |
parent | 8ef5a61dd6bcaa24d26e450041bcba821fa3dbc7 (diff) | |
download | rneovim-d9f97e3026983863d70cbae670bf8277143c8434.tar.gz rneovim-d9f97e3026983863d70cbae670bf8277143c8434.tar.bz2 rneovim-d9f97e3026983863d70cbae670bf8277143c8434.zip |
completion: Add v:completed_item feature #2563
Reviewed-by: Michael Reed <m.reed@mykolab.com>
Reviewed-by: Luke Andrew <luke.github@la.id.au>
Reviewed-by: Justin M. Keyes <justinkz@gmail.com>
Reviewed-by: Florian Walch <florian@fwalch.com>
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index ffbe0e0348..31a5c54c20 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -2734,6 +2734,8 @@ static void ins_compl_clear(void) xfree(compl_orig_text); compl_orig_text = NULL; compl_enter_selects = FALSE; + // clear v:completed_item + set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc()); } /* @@ -3815,6 +3817,8 @@ static void ins_compl_delete(void) // TODO: is this sufficient for redrawing? Redrawing everything causes // flicker, thus we can't do that. changed_cline_bef_curs(); + // clear v:completed_item + set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc()); } /* Insert the new text being completed. */ @@ -3825,6 +3829,21 @@ static void ins_compl_insert(void) compl_used_match = FALSE; else compl_used_match = TRUE; + + // Set completed item. + // { word, abbr, menu, kind, info } + dict_T *dict = dict_alloc(); + dict_add_nr_str(dict, "word", 0L, + EMPTY_IF_NULL(compl_shown_match->cp_str)); + dict_add_nr_str(dict, "abbr", 0L, + EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_ABBR])); + dict_add_nr_str(dict, "menu", 0L, + EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_MENU])); + dict_add_nr_str(dict, "kind", 0L, + EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_KIND])); + dict_add_nr_str(dict, "info", 0L, + EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_INFO])); + set_vim_var_dict(VV_COMPLETED_ITEM, dict); } /* |