Assume $E:SHLVL is already set

This commit is contained in:
Ajeet D'Souza 2021-09-05 23:58:35 +05:30
parent ecc64be909
commit e1127f4b72

View File

@ -25,12 +25,8 @@ var oldpwd = $builtin:pwd
set builtin:before-chdir = [$@builtin:before-chdir [_]{ edit:add-var oldpwd $builtin:pwd }] set builtin:before-chdir = [$@builtin:before-chdir [_]{ edit:add-var oldpwd $builtin:pwd }]
# Initialize hook to add directories to zoxide. # Initialize hook to add directories to zoxide.
var shlvl = $E:SHLVL if (builtin:not (builtin:eq $E:__zoxide_hooked_elvish $E:SHLVL)) {
if (builtin:eq $shlvl "") { set E:__zoxide_hooked_elvish = $E:SHLVL
set shlvl = 0
}
if (builtin:not (builtin:eq $E:__zoxide_hooked_elvish $shlvl)) {
set E:__zoxide_hooked_elvish = $shlvl
{%- match hook %} {%- match hook %}
{%- when InitHook::None %} {%- when InitHook::None %}
{{ not_configured }} {{ not_configured }}