aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/typval.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2017-11-22 22:35:20 +0100
committerGitHub <noreply@github.com>2017-11-22 22:35:20 +0100
commita4f6cec7a31ff8dbfa089b9e22227afbeb951e9b (patch)
tree9bcf55ca9e4ecdbea9390dc750d39027ba7d3acf /src/nvim/eval/typval.c
parent9393be477a733183c2a992cc8728e3ebc65a3118 (diff)
downloadrneovim-a4f6cec7a31ff8dbfa089b9e22227afbeb951e9b.tar.gz
rneovim-a4f6cec7a31ff8dbfa089b9e22227afbeb951e9b.tar.bz2
rneovim-a4f6cec7a31ff8dbfa089b9e22227afbeb951e9b.zip
cmdline: CmdlineEnter and CmdlineLeave autocommands (#7422)
vim-patch:fafcf0dd59fd patch 8.0.1206: no autocmd for entering or leaving the command line Problem: No autocmd for entering or leaving the command line. Solution: Add CmdlineEnter and CmdlineLeave. https://github.com/vim/vim/commit/fafcf0dd59fd9c4ef743bb333ae40d1d322b6079
Diffstat (limited to 'src/nvim/eval/typval.c')
-rw-r--r--src/nvim/eval/typval.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index c339a5cdd2..262ea922ef 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -1374,6 +1374,29 @@ int tv_dict_add_nr(dict_T *const d, const char *const key,
return OK;
}
+/// Add a special entry to dictionary
+///
+/// @param[out] d Dictionary to add entry to.
+/// @param[in] key Key to add.
+/// @param[in] key_len Key length.
+/// @param[in] val SpecialVarValue to add.
+///
+/// @return OK in case of success, FAIL when key already exists.
+int tv_dict_add_special(dict_T *const d, const char *const key,
+ const size_t key_len, SpecialVarValue val)
+{
+ dictitem_T *const item = tv_dict_item_alloc_len(key, key_len);
+
+ item->di_tv.v_lock = VAR_UNLOCKED;
+ item->di_tv.v_type = VAR_SPECIAL;
+ item->di_tv.vval.v_special = val;
+ if (tv_dict_add(d, item) == FAIL) {
+ tv_dict_item_free(item);
+ return FAIL;
+ }
+ return OK;
+}
+
/// Add a string entry to dictionary
///
/// @param[out] d Dictionary to add entry to.