cantino / mcfly

Fly through your shell history. Great Scott!
MIT License
6.89k stars 178 forks source link

Make MCFLY_FUZZY a tuneable int #203

Closed dmfay closed 2 years ago

dmfay commented 2 years ago

Experimenting based on discussion in #183

No extra weight: fuzzy-factor-1

No elaboration needed, it's not great.

Shorter match weighted x2: fuzzy-factor-2

Immediate improvement, with actual ssh commands at the top and most other sorting fairly reasonable. The ./target/relea[se/mcfly search] match is ahead of vi [sql.zsh], but I've definitely run the former several times in this directory (and the latter never).

Shorter match weighted x10: fuzzy-factor-10

There's a point of diminishing returns here and 10 may be past it; ./target/relea[se/mcfly search] is pushed way down, and even higher values (x20, x50) don't look much different.

cantino commented 2 years ago

What happens for folks who have it currently set to true or false? Make sure false maps to 0 and true to 1?

dmfay commented 2 years ago

What happens for folks who have it currently set to true or false? Make sure false maps to 0 and true to 1?

Any string value resolves to 0, disabling fuzzy searching until an int factor >0 is supplied. It is a little disruptive, but I'm also thinking of people who might otherwise not realize there are improvements -- and, hopefully, getting a few more interested parties from the issue to help test and improve the weighting before this lands.

cantino commented 2 years ago

I think it'd be better to be backward compatible and make 'true' map to '1' (or whatever numerical score you think has the best experience).

cantino commented 2 years ago

Also, please run rustfmt. Thanks!

dmfay commented 2 years ago

I had the idea of including match start position in the weighting, so earlier as well as shorter matches are preferred. That makes a big difference already, but a MCFLY_FUZZY of 2 still improves on 1.

cantino commented 2 years ago

Thanks!

cantino commented 2 years ago

Released in 0.5.10.