Mru-files.kak: persistent most-recently-used files history

I’ve been working on mru-files.kak, which maintains a list of MRU files like vim’s :oldfiles. It seems to be stable enough in daily usage.

An improvement over some of the common hacks people use is that history is maintained in a file under /run or /tmp, and only synchronized to “persistent” storage (~/.config/kak/mru-files.txt by default) when the plugin starts / the session exits. So, no spurious writes to potentially slow / fragile storage. This still costs a %sh{} call upon creating a new buffer (existing file or not). It would be better to implement the plugin in pure “kakscript”. However, this would also have a downside: if running multiple sessions, and they are allowed to diverge, they would clobber each other when they eventually do interact with persistent storage.

There is also a small library of POSIX shell utilities to avoid calling external commands in many cases (head, tail, grep, some common awk / cut cases). It also includes some kak helpers (__kak_quote*), per @Screwtapello’s suggestions and as discussed in #3340.

Detailed instructions on the mru-files.kak homepage. Suggestions for other shell functions / kakoune helpers, different implementation ideas etc are obviously welcome

Thanks go to all members of the community who have patiently explained to me how things work as I got to know Kakoune a bit.

8 Likes