Fuzzy matching
SourignaSimmalavong opened this issue · 1 comments
It would be a huge improvement if the user can use the main letters of a word to trigger the wanted word:
e.g. "mkd" would suggest "markdown"
It is much easier to think about "markdown" by start writing "mk" or "md" rather than writing "mar".
In terms of priority inside the suggestions list, here is an order of precedence, from the most important to the least important:
- matching with the beginning of the wanted word (current implementation)
- matching with scattered letters, in the order of the wanted word (e.g. "mkd" would suggest "markdown")
- matching with scattered letters, in disorder of the wanted word (e.g. "awr" would still suggest "markdown")
If this is implemented, it would make things much clearer in the interface if the matching letters are emphasized too (e.g. bold, underlined, color, ...).
Thank you for the nice plugin!
It's funny that you suggested this, because I've been really wanting this lol, especially the second one (scattered letters in order)
I've gone and hacked it in myself in a fork here, but since I've literally overwritten the original behaviour I won't PR it. Use however you wish.
The regex is kinda ugly but it seems to perform fine on my system still.
Edit: The suggestions may be a little buggy though. I'd need to look into that and this was a 5 minute hack. I think it doesn't interact well with ignore case and replace.