romgrk / barbar.nvim

The neovim tabline plugin.
2.23k stars 83 forks source link

[Request] buffer order by frequency #91

Open skt041959 opened 3 years ago

skt041959 commented 3 years ago

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 commented 3 years ago

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.

skt041959 commented 3 years ago

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 commented 3 years ago

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: