-
Notifications
You must be signed in to change notification settings - Fork 571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support autocd option #695
Conversation
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.
just skip the first argument and pass the rest as is. checking for directory breaks cd'ing to symlinked directories
tests are failing
would love to see this merge |
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! |
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: