Share your feedback via email, using Mastodon or
[Plugin] Oldfiles replacement: MRU #(Neo)vim #(Neo)vim-Plugins
After trying countless of terminal file explorers, Yazi is the only one that competes with the simplicity and speed of straightforward commands for me. That’s why I also use it in Neovim, but this came with one caveat: files open with Yazi, don’t show up in the “recent files” list. This list relies on the good old :oldfiles feature. The good news is that you can always easily implement missing features in Neovim with no frictions and without slowing down your favorite text editor. In this case, the solution is called: MRU .
What does MRU.nvim do?
“MRU” stands for Most Recently Used, and the plugin does exactly what it promises: it tracks the files you access and provides a lightning-fast interface to reopen them. At its core, MRU.nvim is about effortless access to your most recently used files.
Beyond that, MRU also offers:
- Dynamic, searchable lists: you can filter and jump to your files with just a few keystrokes.
- Integration-friendly: Works seamlessly with modern Neovim setups and complements popular file explorers and fuzzy-finders.
- Intuitive commands: The interface feels natural to anyone familiar with :oldfiles, so there’s no learning curve if you’re coming from classic Neovim workflows.
Bringing :oldfiles back to yazi.nvim
In essence, MRU.nvim revives the spirit of :oldfiles while embracing modern Neovim plugins. It’s the bridge between nostalgia and productivity.
MRU.nvim is like a productivity hack. Once installed, there’s no complicated configuration or tricks, it just works. Now, whenever I open a file with yazi.nvim, MRU.nvim will keep track on it in its database and I can easily see the “recent files” list by calling :Mru.
Implementation in your favorite picker
By default, MRU.nvim will open the list in the quickfix window, but it also offers default integration with Picker and Telescope. Being a complicated guy, I use none of these tools. My favorite picker if Snacks.nvim .
As I mentioned before, Neovim lets you extend your plugins with new features. Here’s an example with the code to open the “recent files” list from MRU.nvim inside a Snacks.nvim window:
local mru = require("mru")
vim.keymap.set("n", "fh", function()
Snacks.picker({
items = vim.tbl_map(function(path)
return { text = path, file = path }
end, mru.get()),
})
end)Quick, clean, and easy. Now, typing “fh” will open the list in a Snacks.nvim window where I can benefit from additional features like file preview :)