ajeetdsouza / zoxide

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

Support exact match of last component #558

Open markcho opened 1 year ago

markcho commented 1 year ago

I've been a long time user of autojump but recently made the switch to zoxide.

One pain point I have right now is that I can't specify an exact match of the last component.

For example, I have the following directories:

~/somedir/foo
~/somedir/foo-bar
~/somedir/foo-baz
...

Where foo is a prefix to a lot of other dirs.

In autojump, I increased the weight of ~/somedir/foo so that j foo always resolve to this dir. But with zoxide, when calling z foo, the frecency algorithm will prefer other foo- dir if I've visited that more recently.

Would it be possible to support exact match of last component if / is specified like z foo/? Currently, this is used to cd foo/ if foo/ exists, otherwise it matches some other dir like ~/somedir/foo/subdir. It would be useful to have z foo/ match the last component exactly if cd foo/ is not a match.

ajeetdsouza commented 1 year ago

Agreed, this should be a feature. I'll work on this soon.

K900 commented 7 months ago

As someone who often works on nix and nixpkgs, I would like that feature very much.