claude: disable zoxide cd hook in Claude Code subshells #1157
@@ -64,6 +64,16 @@ in
|
|||||||
}' "$target" > "$target.tmp"
|
}' "$target" > "$target.tmp"
|
||||||
${pkgs.coreutils}/bin/mv "$target.tmp" "$target"
|
${pkgs.coreutils}/bin/mv "$target.tmp" "$target"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Disable zoxide cd hook inside Claude Code subshells to avoid cd breakage.
|
||||||
|
# Claude Code sets CLAUDECODE=1 in all subprocesses it spawns (Bash tool,
|
||||||
|
# hooks, MCP, etc.), so we check for that and strip the cd function back out
|
||||||
|
# after zoxide loads unconditionally (mkAfter ensures this runs after zoxide init).
|
||||||
|
programs.zsh.initContent = lib.mkAfter ''
|
||||||
|
if [[ -n "$CLAUDECODE" ]]; then
|
||||||
|
unfunction cd 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user