Closed hat082 closed 2 months ago
the cd command doesn't seem to work?
Can you elaborate?
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
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?
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
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
Something is definitely wrong with your bashrc configuration. If you can share it here, I can take a look.
Thank you so much QAQ bashrc.txt
I believe the ~/.bash_aliases file is empty so that shouldn't be the problem
zoxide -V
--bash
error? You can find it by using set -x
right at the top of your bashrc file (enables debugging).type cd
?with the --cmd cd option i could no longer use cd so i ctrl c out of it
here's the type cd and zoxide -V outputs
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
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)"
That solved the issue. My god you are a genius!
I'm having a similar issue and I've tried everything mentioned in this issue so far. I used the script to install zoxide and added it to my .bashrc. When I source .bashrc
it works fine, but when I start a new terminal it says "Command 'zoxide' not found". I made sure everything was added to $PATH and it works whenever I source the bashrc.
$HOME/.local/bin is already in $PATH
OS: Ubuntu 22.04.4 Kernel: WSL2 Shell: Bash 5.1.16
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:
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?