mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 22:38:16 +00:00
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:
@@ -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,
|
||||
|
Reference in New Issue
Block a user