diff options
author | kuuote <36663503+kuuote@users.noreply.github.com> | 2020-05-25 03:45:25 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-24 20:45:25 +0200 |
commit | e89462d9855eef7718d482df7f92da4279a1c5c3 (patch) | |
tree | 4f7b5164d071b9396a7f3a854a9fb15c251711f1 /src/nvim/eval.c | |
parent | 97bcab8f5eeb8c5b2627fdfc3adad2682bb3681e (diff) | |
download | rneovim-e89462d9855eef7718d482df7f92da4279a1c5c3.tar.gz rneovim-e89462d9855eef7718d482df7f92da4279a1c5c3.tar.bz2 rneovim-e89462d9855eef7718d482df7f92da4279a1c5c3.zip |
vim-patch:8.1.2233: cannot get the Vim command line arguments (#12117)
Problem: Cannot get the Vim command line arguments.
Solution: Add v:argv. (Dmitri Vereshchagin, closes vim/vim#1322)
https://github.com/vim/vim/commit/69bf634858a2a75f2984e42b1e4017bc529a040a
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 4acee7b453..7179e1569c 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -230,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 @@ -8108,6 +8109,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. */ |