Skip to content
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

zoxide: no match found on startup #782

Closed
hat082 opened this issue Apr 6, 2024 · 10 comments
Closed

zoxide: no match found on startup #782

hat082 opened this issue Apr 6, 2024 · 10 comments

Comments

@hat082
Copy link

hat082 commented Apr 6, 2024

I'm using a wsl ubuntu on a windows machine. when i first start up my wsl, the cd command doesn't seem to work?

In my .bashrc:

# z to jump around directories
export _ZO_ECHO=1
eval "$(zoxide init --cmd cd bash)"

Weirdly it works after i either source the bashrc again, when i run eval "$(zoxide init bash --cmd cd)" manually, or when i remove the --cmd cd. Why is this the case?

@ajeetdsouza
Copy link
Owner

the cd command doesn't seem to work?

Can you elaborate?

@ajeetdsouza
Copy link
Owner

P.S. you need cd to a directory the usual way at least once, so that zoxide can learn which directories you use.

This video might help: https://www.youtube.com/watch?v=aghxkpyRVDY

@ajeetdsouza ajeetdsouza added the waiting-for-response Waiting for a response from the issue author. label Apr 20, 2024
@hat082
Copy link
Author

hat082 commented May 3, 2024

I am so sorry for the late reply..
I'm new to github and didn't know how to check notifications...

I did use cd at least once, my understanding is that using $(zoxide init bash --cmd cd) aliases the z command with cd

but if I use this setup i can no longer use cd nor z?

@github-actions github-actions bot removed the waiting-for-response Waiting for a response from the issue author. label May 3, 2024
@hat082
Copy link
Author

hat082 commented May 3, 2024

image
as you can see, if i set this --cmd cd, on startup of the wsl I cannot use cd anymore

but if i source the .bashrc file manually
image

cd (or z's replacement for cd) now works as expected.

the unknown option: --bash is probably from some other line in the .bashrc file I think

@ajeetdsouza
Copy link
Owner

Something is definitely wrong with your bashrc configuration. If you can share it here, I can take a look.

@hat082
Copy link
Author

hat082 commented May 4, 2024

Thank you so much QAQ
bashrc.txt

I believe the ~/.bash_aliases file is empty so that shouldn't be the problem

@ajeetdsouza
Copy link
Owner

ajeetdsouza commented May 5, 2024

  1. The same .bashrc file works for me (WSL + zoxide v0.9.4). Are you running a different version of zoxide?
zoxide -V
  1. Are you able to find the line that's causing the --bash error? You can find it by using set -x right at the top of your bashrc file (enables debugging).
  2. What is the output of type cd?

@ajeetdsouza ajeetdsouza added the waiting-for-response Waiting for a response from the issue author. label May 5, 2024
@hat082
Copy link
Author

hat082 commented May 5, 2024

with the --cmd cd option i could no longer use cd so i ctrl c out of it
image

here's the type cd and zoxide -V outputs
image

image
after i source bashrc it works now

I tried the set -x option and it gives me a lot of outputs but i dont really know how to interpret this output

@github-actions github-actions bot removed the waiting-for-response Waiting for a response from the issue author. label May 5, 2024
@ajeetdsouza
Copy link
Owner

You have 2 versions of zoxide installed on your system. I'm guessing you first installed it using sudo apt install zoxide, and then ran the install script from the README after that.

To fix this:

sudo apt remove zoxide

In your .bashrc:

export PATH="$HOME/.local/bin:$PATH"
eval "$(zoxide init bash --cmd cd)"

@hat082
Copy link
Author

hat082 commented May 5, 2024

That solved the issue. My god you are a genius!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants