jhawthorn / fzy

:mag: A simple, fast fuzzy finder for the terminal
MIT License
2.98k stars 126 forks source link

Idea: multi-word mode as conjunction #6

Closed leahneukirchen closed 7 years ago

leahneukirchen commented 8 years ago

Fzy has a really nice algorithm! One thing many other fuzzy file finders do is split the input on whitespace and use it as a conjunction, i.e. every word needs to match the line (but in any order). Currently, it's a bit hard to use fzy because all letters would need to be in correct order...

E.g. you want to find a pdf in your home folder belonging to project bar, then you need to type "homebarpdf" currently, but with my proposal, you could type "pdf home bar"... as long as all words match somewhere.

Bonus points for negation, e.g. "pdf -bar home" to remove matches for "bar".

jhawthorn commented 8 years ago

Thank you. This is an interesting idea. I'd like to give it more time for consideration, but I'm not sure it fits fzy too well.

I've never found myself wanting to search for words out of order. Maybe others do (please let me know). Though it's something we could add, but it will be extremely tough to score correctly (either very, very slow or not carrying much meaning).

Negation is also a little awkward. When you say "remove matches for 'bar'", if that means removing matches which fuzzy match "bar" I don't think that's a good feature. Fuzzy finding by definition returns false positives. Negating means a user might exclude results by accident, which is bad.

leahneukirchen commented 8 years ago

One usecase is e.g. if you have a project structure lib/foo.rb, test/test_foo.rb, and you want to open foo, and then it shows two choices and you'd need to backspace to make them unique.

sullyj3 commented 8 years ago

When you say "remove matches for 'bar'", if that means removing matches which fuzzy match "bar"

Presumably negation would be based on exact matching rather than fuzzy. I've no idea how difficult something like that would be to implement.

jhawthorn commented 7 years ago

I appreciate the desire for this but it doesn't fit well with fzy's algorithm. It might be solved by a better editing interface as #24 proposes.