Add optional substring matching for picker #5114
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements common syntax that allows matching substrings instead of fuzzy matching.
I will quote the
fzf
README here for an explanation what exactly this does:All of these can be escaped by inserting a backslash
\!
,\^
,\'
and\$
(not mentioned in the README but tested in practice).The implementation here closely matches the behavior of both
fzf
andskim
(which behave identical)I found myself needing these recently.
In particular, I found myself missing the inverse matches.
I work on a circuit simulator (ngspice) which has some core code and then some device models (also just c code).
When I was refactoring core parts of the simulator I wanted to use
gr
to find all references.However, this was polluted by thousands of references in the device models (all of which are inside the
devices
folder).So just being able to add
^devices
in the picker was invaluable.While looking into this I found myself warming up to the other options as well, for example with #5110
^E
can be used to filter only errors or!^H
can be used to ignore hints.