danielfalk / smart-open.nvim

Neovim plugin for fast file-finding
MIT License
444 stars 18 forks source link

Any plans to integrate with fzf-lua? #63

Open niamleeson opened 2 months ago

niamleeson commented 2 months ago

I switched to fzf-lua since it was much faster at finding things than telescope. Would it be possible to integrate with the plugin? https://github.com/ibhagwan/fzf-lua

danielfalk commented 2 months ago

Could you clarify what's faster exactly? Telescope is just providing a picker for smart-open. It doesn't do the finding part, so most of that performance isn't a telescope issue.

Where telescope may be a performance issue is if the picker takes too long to appear (though that seems pretty quick to me).

The place where telescope is a performance issue is where we insert entries into the picker. It seems every time we add an entry, telescope has to process that entry and possibly sort it. This gets slow for hundreds of entries, so we limit the number of entries shown in the picker at any given time--which is generally OK because the whole point of this plugin is to provide you with the thing you were looking for as the top result or at least as close to the top as possible.

niamleeson commented 2 months ago

The UI opening/closing of telescope isn't slow. In my case, the finding files or live grep of telescope was always at least two seconds slower for a huge codebase when compared to fzf-lua on M3 Pro. If your codebase has less than like 1000 files, there is no difference between the two.

Also, I forget if telescope has this, but fzf-lua also has really great fuzzy searching for texts inside all the files. 🙂

srcrip commented 2 months ago

it shouldn't be too hard to do. I have an example here of the same function call filling in telescope, mini.files, and fzf lua: https://github.com/srcrip/torus.nvim/tree/master/lua/torus/integrations I could take a shot at a PR.

srcrip commented 2 months ago

one thing I don't know much about though is how to do custom sorting in fzf-lua. it seems simple enough to dump a lua table into it, but this plugin uses all kinds of custom sorting. I assume fzflua probably respects the order of the table that you give it, but then you'd have to extract the sorting logic that happens in the telescope parts here and order the table before you pass it to fzf lua. or maybe I'm off base here. if anyone knows more about how you do that in fzf lua maybe they can chime in?