vim-patch:8.0.1832: cannot use :unlet for an environment variable

Problem:    Cannot use :unlet for an environment variable.
Solution:   Make it work.  Use unsetenv() if available.
            (Yasuhiro Matsumoto, closes vim/vim#2855)
137374fd65
This commit is contained in:
Jan Edmund Lazo
2018-10-01 22:57:49 -04:00
parent 65206714bc
commit 07fbdf4acc
3 changed files with 44 additions and 0 deletions

View File

@@ -2818,6 +2818,18 @@ static void ex_unletlock(exarg_T *eap, char_u *argstart, int deep)
lval_T lv;
do {
if (*arg == '$') {
const char *name = (char *)++arg;
if (get_env_len((const char_u **)&arg) == 0) {
EMSG2(_(e_invarg2), name - 1);
return;
}
os_unsetenv(name);
arg = skipwhite(arg);
continue;
}
// Parse the name and find the end.
char_u *const name_end = (char_u *)get_lval(arg, NULL, &lv, true,
eap->skip || error,