Sublime Text Ctrl+P Like Fuzzy Matching In Few Lines of Python
crossplatform.net
crossplatform.net
AFAIK Sublime, Ctrl-P and friends all followed and improved from TextMate's version.
It was originally a feature in LaunchBar which was on NextStep and was ported to OS X [1] QuickSilver and Spotlight were also influenced by LaunchBar.
LaunchBar style file opening ! You are a god ! I was going to suggest this as a feature. You have saved us thousands of boring hours clicking on triangles.
Source: http://blog.macromates.com/2005/elevating-the-standard/#comm...
The feature in LaunchBar was btw an evolution of the LaunchBar author having a dozen shell scripts (or aliases) a la “ps=open -a PhotoShop” that he called from a terminal to quickly open his various applications and then later realized it could be automated.
8 years ago, yikes.
As a side note, it's somehow funny how a sentence like "Sublime Text Ctrl+P Like Fuzzy Matching" can tell quite a lot about the person who writes it. I'm not criticizing, of course, but well… I find it funny. That's all.
And some tests here: https://github.com/textmate/textmate/blob/master/Frameworks/...
I too am really amazed this isn't more prevalent as it is so easy to do, after discovering the vim ctrl-p [1] plugin I rarely go a day without using it.
http://www.blueskyonmars.com/2013/03/26/brackets-quick-open-...
But, I'll definitely look up a couple of the links that people have posted here about some other algorithms (Smith-Waterman, for example).
I started hand rolling my own based on Damerau-Levenshtein, but it turns that Python already has a similar implementation in the difflib:
http://docs.python.org/2/library/difflib.html#difflib.get_cl...
It's sort-of abandoned in that I've had a user-submitted patch to fix a major bug since last October, but I haven't had the time to review and apply it yet. I wouldn't suggest anyone use it at this point (I only do because it is exactly what I want; no more, no less), and usually point people to use Eric4 or Eric5, depending on whether you are focused on Python 2.x or Python 3.x .
How often do you print? It's not worth wasting a keystroke.