-
Notifications
You must be signed in to change notification settings - Fork 559
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
Smart case search #224
Comments
One question here is -- should I also think normalizing diacritics ( Accent normalization:
Case normalization:
|
I agree, it should be all or nothing. Or perhaps there should be two types of switches, one that applies case-sensitive search globally if there is at least one with capital letter in search query, and other that infers smart case for each word of query individually.
That would be great as well to have, I happen to speak in language with diacritics, but if I were to choose one of the two only, then it would be smart case. ;) |
Somewhat related: #114 As for me, I would like zoxide to match case-insensitively all the time, with an option to enable case-sensitive matching. Smart case seems overkill. |
@kidonng I'm curious as to why you'd want to disable smartcase matching. I wouldn't expect anyone to use uppercase in a query unless they were hoping for results with the same uppercase letters in them. |
I'm willing to work on this, if that's ok! I'll be trying to send in a PR by tomorrow. |
@PurpleMyst there's already a pending PR on improving search which will very likely conflict with this. I haven't really had time to look into it yet, but for now, I'd recommend against creating a separate PR. |
I seldom disable smart case in any program, but I sometimes want true case-insensitive when I search for copied text that contains capitals. For example if I want to search for "armv7_unknown" but copied text from: CARGO_TARGET_ARMV7_UNKNOWN_LINUX_MUSLEABIHF_LINKER=arm-linux-musleabihf-gcc. And case sensitivity (no smart case) is useful when there's a great pollution of upper case strings but you want to find a lower case string. I suggest the option to disable smart case can be deferred until someone insistently asks for it, since (though it's important) it's so uncommonly used. It may never be an issue in zoxide since zoxide's use case is partly to avoid copying long strings. And because zoxide works on paths rather than codebases, there will be less collision between different cases. Paths don't have the same case convention issues as code (different kinds of tokens having different capitalization). |
A future option should be to turn off smart case, but that's not a priority, for the reasons mentioned here: ajeetdsouza#224
BTW, I just implemented smart case matching in my branch. If you want to try my version with smart case and new keyword-based scoring (I think these features will make it into the official version at some point), you can install it with: |
Somewhat related to that, a lot of characters with diacritics have several representations, for example |
Was progress made on this, or on merging @lefth's branch into the project? |
@etiennepellegrini I haven't pushed to integrate my change, largely because I don't have a solid framework for deciding which matches are best. We could start that effort and gradually improve it by adding a test that lists a lot of filenames and several input strings and confirms that each best match is correct. But there are a lot of arbitrary decisions to be made. Is "Key" input string a better match for "Keystore" or "key" (or .keyStore for that matter)? Is a full word match, full string match, or exact case match considered best? How do other flexible database search engines rank matches? Is there a term of art that describes this ranking so I can search for more info? |
Those are good questions -- I think your idea of figuring out a list of edge cases is a good step. I don't know enough about the internal workings of
So in this scenario, if you have a
|
That is reasonable, especially as a first step. But the engineer in me says at a minimum, the logic should be able to distinguish among directories named "Audio", "Audiobooks", and "Books". (Also, if that doesn't work it's not even as capable as the proof of concept version in my branch.) So maybe we can start with a small test and few heuristics and add more later if there's an issue. |
Hello,
vim has very handy option
smartcase
to do case-sensitive search if there is any capital letter in search query, otherwise search is case-insensitive. I have directory calledV
, and if I typez V
I am moved, e.g. into~/.config/nvim
directory. I have to use longerz parent/V
to givez
a hint. Therefore, I think it makes sense forz
to support notion of smart case as well, it would make tool more comfortable to use.The text was updated successfully, but these errors were encountered: