tofi icon indicating copy to clipboard operation
tofi copied to clipboard

Prefix Matching?

Open LordTlasT opened this issue 1 year ago • 3 comments

Yes this is yet another feature I use from dmenu. (prefix completion patch) I am very pleased and I could stop here, but I'd like to know your opinion.

Prefix matching pairs very well with auto-accept-single, often you already know the first letters of the program you're searching. By matching only the prefix you remove a lot of unnecessary matching in this and it makes cycling through options really quick and snappy.

example: If I only have one password starting with 'a', typing 'a' will select that password instantly.

Nice work, and I wish you a Happy Easter!

LordTlasT avatar Apr 09 '23 23:04 LordTlasT

Interesting, that sounds like a nice idea (I nearly always search by just typing the beginning of the thing I'm looking for).

I think this probably should be combined with #49, and --fuzzy-match replaced with --matching-algorithm. This is also how rofi does it e.g. from the manpage:

-matching method

Specify the matching algorithm used.  Currently, the following methods
are supported:
       • normal: match the int string
       • regex: match a regex input
       • glob: match a glob pattern
       • fuzzy: do a fuzzy match
       • prefix: match prefix

I guess the tofi version would look like:

--matching-algorithm = normal | fuzzy | levenshtein | prefix

Tab completion of results also sounds interesting, but that would probably have to wait until (if) I make keybindings customisable.

philj56 avatar Apr 10 '23 10:04 philj56

Yes, this would be really neat. Can't wait for it to be implemented :) Thanks for the response, I hope it goes well.

LordTlasT avatar Apr 11 '23 14:04 LordTlasT

Alright, this is done (without tab completion) in 574eff0df1aff9bdc6d32939a03312cc08803de3. Sorry for the delay, I spent a while implementing Levenshtein distance, only to decide it isn't really any good for tofi :sweat_smile:.

If you want to try it out from the AUR btw, there's a tofi-git package as well as the release package.

philj56 avatar Apr 17 '23 22:04 philj56