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

[Request] buffer order by frequency #91

Open
skt041959 opened this issue Jan 7, 2021 · 3 comments
Open

[Request] buffer order by frequency #91

skt041959 opened this issue Jan 7, 2021 · 3 comments
Labels
request New feature or request
Milestone

Comments

@skt041959
Copy link
Contributor

Thanks for create this great bufferline tool! It has been much more flexible than airline.
I tend to open a lot of buffers in my workspace and save the session with Startify.
It would be neat if barbar had a feature to

  1. put the most frequently used buffers together
  2. persist the order with a global variable.

I'm new to Lua, but quiet familiar with vim. Just post here for discussion. I will study it too.

Thanks

@romgrk
Copy link
Owner

romgrk commented Jan 7, 2021

It would be interesting. Could you open separate issues for each request and provide more details on the first one? Like how do you see it working, and what rules it would follow.

@romgrk romgrk changed the title [Request] buffer order by frequency and persistent order [Request] buffer order by frequency Jan 7, 2021
@skt041959
Copy link
Contributor Author

We can choose from following two methods:

  1. Use autocmd for BufEnter to count the times that we jump into the buffers
  2. Use timer to check which buffer is visible and raise the score of those buffers. It could be hard to determinate whether vim is idle

I think the plugin should not automatically change the buffer order, but provide a command like BufferReorderByFreq to let the user use it.

@romgrk
Copy link
Owner

romgrk commented Jan 15, 2021

I see. I don't have enough time to implement this but I'll leave open, if I have more time in the future I may revisit, or if you wanna submit a PR I'd accept it.

Comments:

  • For BufEnter, there would need to be a small delay before increasing score, some people use BufferNext/Previous repeatedly to switch and that can fuck the score without the delay
  • Scoring function needs to take in account time of visit

@Iron-E Iron-E added the request New feature or request label Jun 6, 2022
@Iron-E Iron-E added this to the unplanned milestone Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants