fix(zoxide): guard cd/cdi definitions with function existence checks

Prevent errors if zoxide fails to initialize by checking that
__zoxide_z and __zoxide_zi functions exist before defining wrappers.
This commit is contained in:
Jim Myhrberg
2026-01-21 19:48:43 +00:00
parent f1901b81ad
commit f3bb188938

View File

@@ -6,6 +6,10 @@ if command-exists zoxide; then
cached-eval "$(command-path zoxide)" zoxide init --cmd zox zsh
# Use functions to allow regular zsh completion for cd to work.
cd() { __zoxide_z "$@"; }
alias cdi='__zoxide_zi'
if command-exists __zoxide_z; then
cd() { __zoxide_z "$@"; }
fi
if command-exists __zoxide_zi; then
alias cdi='__zoxide_zi'
fi
fi