Reputation: 577
Is there a way to unlet
all variables defined in the current Vim session? You can reset all settings using set all&
, but I can't find an equivalent for variables.
I've tried:
:let vars = g:
:for var in keys(vars)
: unlet var
:endfor
But when I :let g:
, all the variables are still around.
Upvotes: 1
Views: 260
Reputation: 195289
if you really want to do this, you need add the scope (g:
for global), like that:
let vars = g:
for var in keys(vars)
" exec 'unlet g:'.var
unlet g:{var}
endfor
Upvotes: 5