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

store w_last_used timestamp on each window #28742

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

kkrime
Copy link

@kkrime kkrime commented May 14, 2024

fixes #28745

@clason
Copy link
Member

clason commented May 14, 2024

What problem does this solve?

@bfredl
Copy link
Member

bfredl commented May 14, 2024

This can be done with a WinEnter autocmd.

@justinmk
Copy link
Member

justinmk commented May 14, 2024

This could be interesting, because it provides a "history" of object (win/buf/tabpage) usage. I think we clearly want last-used history, and last_used: datetime could avoid maintaining an extra ringbuffer for each object type.

So instead of:

histget('win')
histget('buf')
histget('tabpage')

users/plugins could get the last-used history by sorting on last_used. And even if we provide histget('win'), that could internally use the same approach.

Use-cases: Having a history of last-used bufs/wins/tabs would

  • improve the behavior of g<tab>
  • helps implement ZB (delete buffer without losing split)
  • helps implement histget('win'), histget('buf'), etc.

Caveat: multple windows could have the same last_used timestamp, then the "history" is not 100% reliable. But storing microsecond-granularity should be good enough.

@justinmk justinmk changed the title added w_last_used to struct window_S store w_last_used timestamp on each window May 14, 2024
@kkrime
Copy link
Author

kkrime commented May 14, 2024

Hi All,

Thank you for looking into this PR, if you want more context for this chance, please take a look at #28745

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.

lastused property for windows/buffers/tabpages ("MRU history")
4 participants