There is a buffer field last_used which is not exposed anywhere except in viminfo. This could be useful to add some features for navigating between the most recently used buffers.
Proposals (in order of increasing complexity):
- add last_used to getbufinfo for plugins to use.
- :ls t sorts buffers by last_used (most recent first) and displays the time (e.g., "3 seconds ago").
- when tab completing the :buffer command line, buffers may be displayed sorted by recency (except for current buffer).
Adequate testing is a problem because it would incur a few seconds delay.
https://github.com/vim/vim/pull/4722
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
❗️ No coverage uploaded for pull request base (
master@c332816). Click here to learn what that means.
The diff coverage is44.68%.
@@ Coverage Diff @@ ## master #4722 +/- ## ========================================= Coverage ? 81.39% ========================================= Files ? 115 Lines ? 145330 Branches ? 0 ========================================= Hits ? 118286 Misses ? 27044 Partials ? 0
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/undo.c | 83.23% <ø> (ø) |
|
| src/viminfo.c | 76.63% <ø> (ø) |
|
| src/evalfunc.c | 89.47% <100%> (ø) |
|
| src/buffer.c | 84.13% <40%> (ø) |
|
| src/option.c | 86.66% <50%> (ø) |
|
| src/ex_getln.c | 76.9% <55.55%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered by Codecov. Last update c332816...544044d. Read the comment docs.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.![]()
This needs to be synced with head. And please add a test, using test_settime() should work.
@justinmk commented on this pull request.
In src/undo.c:
> @@ -3107,7 +3106,7 @@ ex_undolist(exarg_T *eap UNUSED) /* * Put the timestamp of an undo header in "buf[buflen]" in a nice format. */ - static void + void u_add_time(char_u *buf, size_t buflen, time_t tt)
This is no longer undo-specific.
@justinmk commented on this pull request.
> @@ -4457,6 +4457,9 @@ getbufinfo([{dict}])
changed TRUE if the buffer is modified.
changedtick number of changes made to the buffer.
hidden TRUE if the buffer is hidden.
+ last_used time in seconds when the buffer was
+ last used.
+ {only with the |+viminfo| feature}
I would remove the underscore. Because changedtick doesn't have one, and for parallel with list:lastused.
@brammool commented on this pull request.
> @@ -4457,6 +4457,9 @@ getbufinfo([{dict}])
changed TRUE if the buffer is modified.
changedtick number of changes made to the buffer.
hidden TRUE if the buffer is hidden.
+ last_used time in seconds when the buffer was
+ last used.
+ {only with the |+viminfo| feature}
Agree
Thanks for the comments, writing tests now. Do we know what the definition of "last used" is? Does having a buffer open in a window without editing count? E.g. what if I open a buffer at 3:00, do nothing, and switch to another buffer at 7:00? What about hidden buffers? Does it matter if a buffer is new or existing?
Tests added
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()