Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

History/MRU picker #433

Closed
kristijanhusak opened this issue Jan 13, 2021 · 10 comments
Closed

History/MRU picker #433

kristijanhusak opened this issue Jan 13, 2021 · 10 comments
Labels
enhancement Enhancement to performance, inner workings or existent features

Comments

@kristijanhusak
Copy link

Is your feature request related to a problem? Please describe.
I switched from fzf, and one source that I miss the most is :History, which lists oldfiles + buffers (sorted by MRU).

Describe the solution you'd like
I'd like to have a separate picker that holds these.

Describe alternatives you've considered
I didn't find a solution for this so I implemented it myself in a same way fzf does it. Here are part of codes:

I wanted to check if you would be interested in adding this here, and if yes, I could make a PR with the implementation.

@kristijanhusak kristijanhusak added the enhancement Enhancement to performance, inner workings or existent features label Jan 13, 2021
@Conni2461
Copy link
Member

Thanks for the request.

@sunjon was working on a "smart" MRU based on that article which should be almost done.
He can tell you more :)

@kristijanhusak
Copy link
Author

Oh, nice :)
Is there a related issue/PR that I can track? I wasn't able to find anything related to MRU.
I guess I'll just stick with my version until smarter one is finished :)

@sunjon
Copy link
Contributor

sunjon commented Jan 14, 2021

Hi. It's WIP (as in not usable yet), but I've put the repo up here.
The todo's are listed in the readme, and I'll move the project to the 'nvim-lua' namespace when it's complete.

Hope to have it in a testable order in the next couple of days.

@sunjon
Copy link
Contributor

sunjon commented Jan 19, 2021

Closing this as the frecency MRU finder has been released.
Hope it satisfies your requirements!

@sunjon sunjon closed this as completed Jan 19, 2021
@kristijanhusak
Copy link
Author

Thanks, I'll give it a try.

@kristijanhusak
Copy link
Author

I gave this a test, it is working fine, but it doesn't work exactly how I'm used to it. If I open a file that I never opened before, I expect it to be first in the list when I open up the picker, which is not the case with this one. Of course, that's how it works by design, so no complains there :) I'll stick with my implementation. If someone shows interest in using my implementation I'll make a separate package for that.
Thanks anyway.

@jesseleite
Copy link
Contributor

jesseleite commented Mar 14, 2021

Hey @kristijanhusak, seconded, and thank you for sharing this! @Conni2461 @sunjon, I think the frecency thing is really cool, but it's different than MRU...

Frecency = Frequency + Recency
MRU = Recency only

PS. @kristijanhusak curious though regarding your save_buf() + remove_buf() + autocommand buffer tracking...

  1. Regarding the use of remove_buf(), I always found fzf's remove buffer functionality within :History confusing. Whether or not I close a buffer, I would still expect it to show in :History, since I did in fact open it. If I restart Vim, it would be in the oldfiles list, so why not leave it in the list, even after closing buffers?

  2. Why not instead parse :buffers! t (the ! bang will show unlisted/deleted buffers, and the t flag sorts buffers by time last used), and then filter the results by filereadable()? I'm curious if there is a reason why you're manually tracking buffers to a variable in memory?

@kristijanhusak
Copy link
Author

@jesseleite I mostly copied how FZF works, but you have the point.
I'm not sure if there is a way to list buffers as :buffers! t through code. It's really hard and nasty to read output of the command line.

@jesseleite
Copy link
Contributor

@kristijanhusak ^ Check the PR there when you have a chance! I'm parsing :buffers! t output fairly easily. Works just like fzf's :History now, but without the awkward remove-buffer functionality.

@kristijanhusak
Copy link
Author

@jesseleite Awesome! I'll gladly replace my custom functionality for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to performance, inner workings or existent features
Projects
None yet
Development

No branches or pull requests

4 participants