Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/Feature: If two directories have the same score for a query, the one that matches most should win #56

Open
zachriggle opened this issue Nov 11, 2021 · 3 comments

Comments

@zachriggle
Copy link

Since I've written a script that does zshz --add $PWD for all of the source code repos I have to engage with, and set ZSHZ_MAX_SCORE=0, zshz has been better than ever.

However, it has the unfortunate side-effect of moving me to the wrong directory sometimes.

Consider the following:

$ z -l fizzbuzz
1          /Users/zachriggle/src/project/fizzbuzzservices
1          /Users/zachriggle/src/project/fizzbuzz1
1          /Users/zachriggle/src/project/fizzbuzzkext

The current code will cd into fizzbuzzkext. I think that fizzbuzz1 should win here, given that it has the most matching characters.

I expect in most cases, "the most matching characters" will end up being the shortest ${dirname:t}, so that can probably be used as a proxy.

@agkozak
Copy link
Owner

agkozak commented Nov 17, 2021

it has the most matching characters.

Wouldn't it be fair to say that the three examples have an equal number of matching characters, and that the one you want has the fewest extraneous characters?

@zachriggle
Copy link
Author

zachriggle commented Nov 21, 2021 via email

@agkozak
Copy link
Owner

agkozak commented Nov 21, 2021

OK. I'll see what I can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants