When an environment variable isn't set, exists()
return false. We can assign a value to the variable with :let
, after which point it exists. But we can't revert to an non-existent state (related to unsetenv (3C)
)
call assert_false(exists('$FOOBAR')) let $FOOBAR = 1 call assert_true(exists('$FOOBAR')) unlet $FOOBAR call assert_false(exists('$FOOBAR'))
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
It's in the todo list:
Can we make ":unlet $VAR" use unsetenv() to delete the env var?
What for systems that don't have unsetenv()?
If I would want to implement this, where do I start?
As I mentioned in #2854, Vim doesn't have a way to revert $TZ
. So we should implement unlet $FOOBAR
.
It looks like this issue can be closed. Patch 8.0.1832 took care of this.
closing.
Closed #1116.