Closed stephane-archer closed 1 month ago
Why have you replaced the __zoxide_cd_internal function?
@ajeetdsouza because cd
has been disabled with an alias to force me to use zoxide, so I need zoxide to use the built-in cd, not the alias.
builtin cd
does not support cd -
. To solve this issue, remove the custom __zoxide_cd_internal
function, and disable cd
after you initialize zoxide.
@ajeetdsouza
removing the custom __zoxide_cd_internal
then
if status --is-interactive
zoxide init fish | source
end
function cd
if status is-interactive
echo "Use z"
return 1
end
builtin cd $argv
end
doesn't work for me. I see Use z
when using zoxide
Your version of zoxide is likely out of date. Can you try with the latest version?
I use this version
zoxide 0.9.4
I think it's the last one?
Works for me:
Can you check if you've set a cd
alias using --save
that's getting loaded before zoxide?
@ajeetdsouza This works for me now, I still had a cd
defined in fish/.config/fish/function/
it's strange to me that you depend on the current cd
on the system. Why did you make that choice?
Thank you for the help.
Unlike most shells, Fish's builtin cd
does not work with cd -
, cd +
etc. Instead, it's defined in a separate function that internally calls builtin cd
. I believe on one of their GitHub issues they mentioned moving all this logic into the builtin, but that has not been picked up yet.
In other shells, zoxide depends on builtin cd
(or equivalent) which is useful when users alias cd
to something else, but on Fish, the only options seem to be:
builtin cd
and don't support cd -
/ cd +
/ etc.cd
function verbatim from Fish's repo into zoxide, and use that.cd
function that is available into __zoxide_cd_internal
. The condition here is that you must only alias cd after initializing zoxide.Option 2 will use FIsh's internal variables for tracking the directory stack, but if any of them get renamed in a later Fish version, or if the function uses some newer features of Fish, it will behave differently. For that reason, I picked option 3, but it's causing enough confusion that I'm considering moving to option 2.
zoxide doesn't go to the previous directory:
config.fish