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

Add Sort by MRU #149 #535

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add Sort by MRU #149 #535

wants to merge 2 commits into from

Conversation

bluexnine
Copy link

This patch adds sorting by mru feature. The bufferline will sort base
on the last used time. Also add a command to sort by mru.

This patch adds sorting by mru feature. The bufferline will sort base
on the last used time. Also add a command to sort by mru.
@akinsho
Copy link
Owner

akinsho commented Sep 6, 2022

@bluexnine I believe I've tried this strategy before, and it doesn't work very well since the lastused variables changes immediately which then means that the position of buffers in this sort is constantly changing, e.g. if I moved from left to right the positions of the buffers would likely switch constantly. Ideally an MRU sort would be a little more stable so that it only shifted buffers after a certain amount of time and based on a weighting e.g. it wouldn't reorder things just because you went in and out one time but based on if you were spending large amounts of time in one buffer vs another

@bluexnine
Copy link
Author

@akinsho You are correct that the buffers does re-organize every time a new buffer is selected. That constant re-org feature is what I wanted and believes it is true to the "most recently used" feature. I think other users may find acceptable. Over time when using this feature, the mru would result in showing the most often buffers first which will reflect as "weighted" since buffers that are not re-select will fall further back and more commonly used buffer will go to the front.

I do believe weight of time is a feature that sounds interesting. It would need some sort of caching to record use time. The caching and recalculating of used time will make the plugin heavy as more buffers are added. Also another issue I can foresee is that new buffers might always be on the bottom and may confuse users when the new tab does not show up. How do you see new bufffers being organize or do you feel this is not a concern? This feature could be another sort_by feature.

Let me know if you want to adopt the patch. I can always add it as a function.

@akinsho
Copy link
Owner

akinsho commented Sep 7, 2022

@bluexnine so the many complexities you raise are exactly why this feature hasn't been implemented yet/why I've considered it as something for a supporting plugin, maybe not sure which yet. If you read through #149 you'll see there's been more discussion around a more complex solution. Personally, I think a solution where the buffers constantly move isn't really user-friendly or at least will lead to a lot of complaints, I'm not ready for.

@bluexnine
Copy link
Author

@akinsho Thank you for your comments and thoughts. I have read through the issues and they seem to touch upon the same concepts we have touch on. It seems that the definition of the feature you have in mind has not been clearly defined. Let me see if I can ask the census through from the #149 thread and define what you and the users are looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants