Crates.io | nucleo-picker |
lib.rs | nucleo-picker |
version | 0.5.0 |
source | src |
created_at | 2024-08-20 23:15:30.754365 |
updated_at | 2024-11-07 20:12:34.99991 |
description | A fuzzy picker tui library based on nucleo |
homepage | |
repository | https://github.com/autobib/nucleo-picker |
max_upload_size | |
id | 1345860 |
size | 67,831 |
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.
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.skim
and inherits skim
's problems.String
.FuzzySelect
only has a blocking API and only supports matching on String
.
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!