axkirillov / hbac.nvim

Heuristic buffer auto-close
MIT License
197 stars 10 forks source link

Sort telescope results by recency #12

Closed technicalpickles closed 10 months ago

technicalpickles commented 1 year ago

When I have a lot of files open, I usually end up navigating exclusively through Hbac Telescope. I don't know how feasible it is, but I would love to be able to see the results in it sorted by most recently viewed.

I don't know if nvim has some concept of when a buffer was last open and visibile, and I'm sure it would get a little complicated like if you have splits with multiple files open... https://github.com/nvim-telescope/telescope-frecency.nvim is something in that space, but it has to use a sqlite database to do it.

axkirillov commented 1 year ago

If by most recently viewed you mean within a session, then its totally doable. Currently we get the entries for the picker using utils.get_listed_buffers https://github.com/axkirillov/hbac.nvim/blob/afb38c35327e763e5b3b72cad09ed76e37219ace/lua/hbac/telescope/make_finder.lua#L11 We need a different function that also sorts the entries using a sorting table. The sorting table should be placed in the state module and updated on each BufEnter. I can't promise that I'll find time to implement it, but you are welcome to open a PR of course.

technicalpickles commented 1 year ago

If by most recently viewed you mean within a session, then its totally doable.

Yep! That is exactly what I mean.

Thanks for the pointer on where to look for implementation. May try my hand if I get annoyed enough 😁

axkirillov commented 11 months ago

@technicalpickles Hi! The features discussed here are now in the latest 2.0.0 release! Could you please update your config to use the master branch and check that everything works for you? If yes, we can close the issue.

axkirillov commented 10 months ago

Hi again 🙂! I am going to close this. You can reopen the issue or create a new one if you find any problems.