diff options
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index b5b40061b5..ad7d327de3 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -7226,6 +7226,17 @@ void set_vim_var_dict(const VimVarIndex idx, dict_T *const val) tv_dict_set_keys_readonly(val); } +/// Set v:variable to tv. +/// +/// @param[in] idx Index of variable to set. +/// @param[in,out] val Value to set to. Reference count will be incremented. +/// Also keys of the dictionary will be made read-only. +void set_vim_var_tv(const VimVarIndex idx, typval_T *const tv) +{ + tv_clear(&vimvars[idx].vv_di.di_tv); + vimvars[idx].vv_di.di_tv = *tv; +} + /// Set the v:argv list. void set_argv_var(char **argv, int argc) { |