Back

A different approach to fuzzy finding

58 points22 hoursnathancraddock.com
krobelus7 hours ago

> Notice that both fzf and fzy ranked source/blender/makesdna/DNA_fileglobal_types.h higher than GNUMakefile. I believe this is because /make and _file in that path are on word boundaries and are ranked higher than UMakefile that is not on a word boundary.

The reason for prioritizing word boundaries is so that you can type "sln" to match "SomeLongName". So while you are improving one use case you are probably breaking another one. I'm not sure how VSCode ranks GNUmakefile first, maybe they prioritize exact substring matches. It's still a heuristic that can fail. The ugly part is that it's not part of the "best match" algorithm that finds a global optimum.

> It first attempts a match on the filename. If there is no match, it retries on the full candidate string

Kakoune does the same, see https://github.com/mawww/kakoune/blob/019fbc5439ad884f172c32...

> Strict path matching means that the path segments of the query token cannot overlap between path segments in the candidate.

nice

celeritascelery7 hours ago

This is a great post! Fuzzy finders are really useful, and we are always trying to find a tool that will “read our mind” and give us the thing we are looking for as quick as possible. One thing that I found really useful is sorting based on past searches. If I search for the same type of files commonly (like make files) then the sorting will put those higher. Often times I don’t even need to type anything because the file I want it the first one!

ithrow9 hours ago

Looks like the author doesn't know about FZF's different search syntaxes https://github.com/junegunn/fzf#search-syntax

If they had left quoted the word makefile, GNUmakefile would have been the first result.

cturtle9 hours ago

Author here! I’m aware of the FZF search syntaxes. They are very useful! I designed zf to be a small tool that worked a bit better for me by default without special syntaxes.

celeritascelery8 hours ago

Would that have been the case even if there was a directory along the path called “makefile”? Or would the paths with that directory get ranked higher because the matches string occurs earlier in the path?

ithkuil5 hours ago

Or a directory called "remakefiletsrecipe"