ajeetdsouza / zoxide

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

Support regexp #851

Closed ruirlliu closed 3 weeks ago

ruirlliu commented 3 months ago

Thanks for your work on this tool, it's very useful to switch folders for me.

However, I found zoxide doesn't support regexp ( didn't find in the wiki ), if there are some folders with similar name, zoxide may jumps into the wrong folder.

For instance,

z ~/a/b/c
z ~/a/b/c1
z ~/a/b/c2

# cd to the folder c
z  c
# jumped into wrong folder
~/a/b/c1

If zoxide supports regexp, it's easy to jump into a specific folder, such as:

# cd to a folder ends with c
z c$

~/a/b/c

More info:

ajeetdsouza commented 3 weeks ago

I don't think regex is the correct solution here.

Implementing regex in zoxide would be one library import away, and regex is a fantastic tool - but IMHO it's the wrong tool for the job. That said, if you still want functionality like this, zoxide is designed to be scriptable - you should be able to set up something with zoxide query --list and grep.