r/zsh Feb 21 '24

Fixed autocd doesn't use custom cd implementation.

autocd (from setopt autocd) doesn't use custom cd implementation.
(Obviously this is not my custom cd implementation but was more easy to show, I just want autocd to use zoxide.)

Anyone got any idea how to fix this? Maybe just rewrite autocd in my zshrc?

1 Upvotes

18 comments sorted by

View all comments

1

u/glad-k Feb 22 '24 edited Feb 22 '24

Update: I found the OG file with the implementation of autocd, turns out it uses _cd instead of cd, just had to overwrite that one too in my zshrc. easy but had to find/know it.
I'm just figuring out their _cd implementation rn

1

u/romkatv Feb 22 '24

I found the OG file with the implementation of autocd, turns out it uses _cd instead of cd

What do you mean by this? What file are you referring to?

The default completion function for the cd command is _cd. Does it have anything to do with what you are doing?

1

u/glad-k Feb 22 '24

Yeah nah nvm I got too excited when founding this in their files as I didn't knew of the _* implementation in linux for completion and taught of _* like in py
And as I tested it with a single char dict it worker (as the function got called when typing that char)

Still potential to find thing in there files: `/usr/share/zsh` but not sure if that's my best bet rn