Yet another fuzzy picker library.
This library provides a TUI for the nucleo
crate, but otherwise attempts to be a relatively thin wrapper.
As a result, you get the great features of nucleo
for free™.
This crate tries not to interfere with the API choices made by nucleo
.
See the examples
directory for implementation examples, or try it out with cargo run --example blocking
.
Currently, we only directly load two dependencies:
This crate mainly exists as a result of the author's annoyance with pretty much every fuzzy picker TUI in the rust ecosystem.
- skim's
Arc<dyn SkimItem>
is very inconvenient since the original item cannot be recovered from the match.skim
also contains a large amount of dependency baggage. - fuzzypicker is based on
skim
and inheritsskim
's problems. - nucleo-ui only has a blocking API and only supports matching on
String
. - fuzzy-select only has a blocking API.
- dialoguer
FuzzySelect
only has a blocking API and only supports matching onString
. The terminal handling also has a few strange bugs.
The query syntax is as documented in the nucleo-matcher crate.
Essentially, each query is parsed as a sequence of whitespace-separated "atoms", such as a1 a2 a3
.
By default, each atom corresponds to a fuzzy match: that is, higher score is assigned for a closer match, but exact match is not required.
There is also a special syntax for various types of exact matches.
'foo
match an exact substring, with negation!foo
^foo
must match an exact prefix, with negation!^foo
foo$
must match an exact suffix, with negation!foo$
^foo$
must match the entire string exactly, with negation!^foo$
Whitespace and control symbols '^$!
can also be interpreted literally by escaping with a backslash \
.
For example, the query foo ^bar
means that we match for strings which contain foo
(or similar), and which begin with the exact string bar
.
The feature set of this library is quite minimal (by design) but may be expanded in the future. There are a currently a few known problems which have not been addressed (see the issues page on GitHub for a list).
This crate is not affiliated with the authors of nucleo
, but if they have comments / complaints I am very glad to hear them!