From f3bb188938070ce4a42173f62fca205806d5a5a8 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Wed, 21 Jan 2026 19:48:43 +0000 Subject: [PATCH] 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. --- zsh/zoxide.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zsh/zoxide.zsh b/zsh/zoxide.zsh index bf68c3a..27a3ca9 100644 --- a/zsh/zoxide.zsh +++ b/zsh/zoxide.zsh @@ -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