ajeetdsouza / zoxide

A smarter cd command. Supports all major shells.
MIT License
22.84k stars 556 forks source link

zoxide doesn't match on parent directories #90

Closed tekumara closed 4 years ago

tekumara commented 4 years ago

zoxide doesn't match on parent directories, eg:

$  za /Users/tekumara/Library/Application\ Support/zoxide
$  zq app
Error: no match found

Whereas rupa/z will find a match when a parent directory matches:

$ z app -l
common:    /Users/tekumara/Library/Application Support/zoxide
239884     /Users/tekumara/Library/Application Support/zoxide
ajeetdsouza commented 4 years ago

Hey @tekumara,

zoxide always ensures that the last keyword in a query matches the actual directory name, so /home/foo can be matched with:

However, by design, it will not match:

IMO, requiring (part of) the name of the directory at the end drastically improves the quality of the results. Usually, if I've forgotten the name of the directory, I just use zi to find it.

Is there a reason you would want zoxide to match on parent directories?

tekumara commented 4 years ago

Even if different from rupa/z that seems fair and workable! It’s probably only really a difference for the first time I’d want to traverse up to a parent. cd will suffice 😀 It’s a small adjustment on my part and understanding the logic helps. I might have missed the explanation in the doco.

ajeetdsouza commented 4 years ago

That's alright, do let me know if you think the README could have been clearer!

Btw, you can use zoxide exactly like cd! The following commands would be completely valid and would not even need to access the database:

More examples - all of the following navigate to /home:

I'm closing this issue, but feel free to re-open it if you have more questions!