ninja-keys icon indicating copy to clipboard operation
ninja-keys copied to clipboard

Command fuzzy matching

Open bengry opened this issue 3 years ago • 3 comments

Allow commands to be fuzzy-matched when searching (with something like https://github.com/farzher/fuzzysort, but not necessarily it).

Potentially also allow typos. e.g. for command named Open allow searching using Opne (within a threshold)

bengry avatar Feb 09 '22 10:02 bengry

Thanks for suggestion! Yea, sounds as a good feature.

I will add this functionality, but need to check if there are other smaller libs or implement it inside. Because I don't want to grow dependencies a lot or at least want to keep size small.

So, if you or anyone have other suggestions for libs/repos, drop a link here. Cheers!

ssleptsov avatar Feb 10 '22 08:02 ssleptsov

@ssleptsov as a potential workaround, as to not have this built in - you could expose a matcher function (passed in a similar way to the commands I guess? I'm not super familiar with Web Components, but I assume you can't pass non-seriazable things using attributes) and let the consumer optionally provide it, having them bear the bundle size increase.

Default would be the current regex matching that's done.

Having said that, I think since you may also want a different order for results, that might have to be exposed via the same (?) api as well.

bengry avatar Feb 10 '22 08:02 bengry

Kbar uses this internally https://github.com/superhuman/command-score

Screen Shot 2022-05-08 at 1 11 36 AM

wobsoriano avatar May 08 '22 08:05 wobsoriano