diff options
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index ced3613005..017d46e802 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -63,6 +63,7 @@ static char *e_missbrac = N_("E111: Missing ']'"); static char *e_dictrange = N_("E719: Cannot use [:] with a Dictionary"); static char *e_illvar = N_("E461: Illegal variable name: %s"); static char *e_cannot_mod = N_("E995: Cannot modify existing variable"); +static char *e_invalwindow = N_("E957: Invalid window number"); // TODO(ZyX-I): move to eval/executor static char *e_letwrong = N_("E734: Wrong variable type for %s="); @@ -229,6 +230,7 @@ static struct vimvar { VV(VV_ECHOSPACE, "echospace", VAR_NUMBER, VV_RO), VV(VV_EXITING, "exiting", VAR_NUMBER, VV_RO), VV(VV_LUA, "lua", VAR_PARTIAL, VV_RO), + VV(VV_ARGV, "argv", VAR_LIST, VV_RO), }; #undef VV @@ -6778,7 +6780,7 @@ int matchadd_dict_arg(typval_T *tv, const char **conceal_char, if ((di = tv_dict_find(tv->vval.v_dict, S_LEN("window"))) != NULL) { *win = find_win_by_nr_or_id(&di->di_tv); if (*win == NULL) { - EMSG(_("E957: Invalid window number")); + EMSG(_(e_invalwindow)); return FAIL; } } @@ -8109,6 +8111,23 @@ void set_vim_var_dict(const VimVarIndex idx, dict_T *const val) } } +/// Set the v:argv list. +void set_argv_var(char **argv, int argc) +{ + list_T *l = tv_list_alloc(argc); + int i; + + if (l == NULL) { + getout(1); + } + tv_list_set_lock(l, VAR_FIXED); + for (i = 0; i < argc; i++) { + tv_list_append_string(l, (const char *const)argv[i], -1); + TV_LIST_ITEM_TV(tv_list_last(l))->v_lock = VAR_FIXED; + } + set_vim_var_list(VV_ARGV, l); +} + /* * Set v:register if needed. */ |