kien/ctrlp.vim — Issue #120: Fuzzy algorithm appears to sort incorrectly
Author: DelvarWorld
Created: 2012-01-30 20:01:45+00:00
State: open

If I open ctrl-p and type in "abc-xy" it shows me

folder/folder/a000-b000-c000-x0000.yml

Where instead this is the file I really want:

folder/folder/abc-000000.xy

I'm having trouble creating an isolated test case for this. I tried making a new folder with the two files in the same relative folder structures, but in that case the correct file shows up first. But in my project, the wrong file definitely shows up first. How are you weighting the search results? I briefly looked through the source but didn't see anything obvious.

I tried to find the weighting algorithm in the source but didn't find anything. Are you doing it by a regex? Because fuzzy sorting can't be done that way. You have to weight based on the distance between the letters matched.

If I type the same string into Command-T I get the correct file first.