-
Notifications
You must be signed in to change notification settings - Fork 321
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
Option for case-insensitive search #69
Comments
For reference, these are called For the rest of the suggestion, you mention three alternatives. If you ask me, (1) fuzzy matching is too imprecise for regular searching. It is mostly aimed to save keystrokes when matches are displayed as an interactive list so even if we implement something like I'm in favour of option (2), option (3) is a close second, and I think we should skip option (1) for this issue. For me there are a few important considerations. First, users should not be required to learn something new. If I'm not mistaken, vim already have multiple regular expression syntaxes (i.e. |
I would advocate for the option (3). Actually it seems dead simple to convert a wildcard to a Go RE2 regex - see e.g. https://github.com/blevesearch/bleve/blob/master/search/query/wildcard.go . Also I would rather avoid direct regex input as (a) it's verbose, (b) it won't bring basically any benefits (in my whole life I've come across just about 4 file name matching issues which were too complex for wildcards and needed to be solved by some small additional logic), but mainly (c) it's confusing for users (as it was already many years ago: |
I have been doing some reading. I was thinking regular expressions and wildcards (or globbing) are related but I guess they are not. It looks like wildcards are much simpler and aimed for matching filenames whereas regular expressions are more complicated aimed for matching any kind of text. I think it makes sense for us to use wildcards. I like the idea of keeping it simple. That code you linked tries to use regular expressions to implement wildcards but there already seems to be a wildcard implementation in the standard library: |
Didn't notice. That's great! |
All three options mentioned here are now implemented. I have enabled |
Currently the search is a perfect match (thus also case sensitive). I'd like to have an option to switch case insensitive matching on or even the "combination" of case (in)sensitive matching - i.e. when the searched term contains at least one upper letter, do a case sensitive search and in other cases do a case insensitive match (I use this "combined" matching all the time in vim).
Hm, thinking about search functionality improvements, maybe support for wildcards
*
and?
or even a fuzzy match (but this would require an external library for nearly no benefit) or at least support for "multi partial match" search (i.e. split the searched string by[[:blank:]]+
into words and then try to find the first word in the text, if found, start searching for the second word from the position of the character right behind the last character of the first match, if found, start searching for the third word from the position of the character right behind the last character of the second match, etc. - in other words a wildcard matching*word1*word2*word3*
) would be very handy (regexes are too precise and not so concise).Any comments on these suggestions? Of course, the exact behaviors should be then described in
lf -doc
.The text was updated successfully, but these errors were encountered: