Closed solodov closed 3 weeks ago
would love to see this merge
Would this work for zsh as well?
Would this work for zsh as well?
I updated the initial comment with reproduction steps for bash. Checked in zsh and seems to work correctly already:
% setopt autocd
% eval "$(zoxide init --cmd cd zsh)"
% /
@ajeetdsouza Is there any update on this? Seems like a very useful feature to have!
@ajeetdsouza Is there any update on this? Seems like a very useful feature to have!
PR is ready to be merged, as far as I'm concerned. I've been using this fix for a few months now, everything seems to be ok.
bump
This seems like a neat improvement. @ajeetdsouza any updates on this?
In bash, when autocd option is set and user enters a directory name as a command, it results in a very specific call to cd:
cd -- [directory name]
zoxide's directory changing function passes all arguments to __zoxide_z as is, including the "--" first argument. By detecting this and skipping the first argument changing directory works with autocd set.
This particular bug only happens when initializing zoxide with
--cmd cd
. Here's how it breaks in bash: