mru.nvim
July 14, 2026 ยท View on GitHub
A lightweight Neovim plugin to manage and display your Most Recently Used (MRU) files.
- ๐ Intro
- โ Why not v:oldfiles?
- โจ Features
- ๐ฆ Installation
- ๐ง Configuration
- โ๏ธ Basic Usage
- ๐ฃ Self-Promotion
- ๐ License
๐ Intro
mru.nvim keeps track of the files you've recently opened in Neovim and
provides quick access to them via quickfix, picker.nvim, or telescope.nvim extension.
โ Why not v:oldfiles?
mru.nvim does not aim to replace v:oldfiles directly.
Instead, it maintains its own MRU tracking to address several practical limitations:
- Unified path format:
v:oldfilesmay contain inconsistent or duplicated paths on Windows. - Regex-based path filtering: Exclude files or directories to avoid recording sensitive paths.
- Editable and persistent: The MRU list can be modified, and changes remain effective after restarting Neovim.
- Fuzzy search support: Integrates with picker.nvim or telescope.nvim for fuzzy searching recently edited files.
- Flexible sorting strategies: Sort by last enter time, read time, modified time, or frecency.
โจ Features
- Unified file path format - Consistent paths across platforms.
- Regex-based path filtering - Exclude sensitive or unwanted paths.
- Lightweight and no dependencies - Zero required dependencies.
- Devicons support - Optional integration with nvim-web-devicons.
- Flexible sorting - Sort by
lastenter,lastread,lastmod, orfrecency. - Persistent cache - MRU list survives Neovim restarts.
- Backup and recover - Clear and restore your MRU list anytime.
๐ฆ Installation
Use your preferred Neovim plugin manager to install mru.nvim.
Using nvim-plug:
require('plug').add({
{ 'wsdjeg/mru.nvim' }
})
Then use :PlugInstall mru.nvim to install this plugin.
Using LuaRocks:
luarocks install mru.nvim
๐ง Configuration
The following is the default option of mru.nvim.
require('mru').setup({
-- enable or disable cache (default: true)
enable_cache = true,
-- cache file path (default: stdpath('data') .. '/nvim-mru.json')
mru_cache_file = vim.fn.stdpath('data') .. '/nvim-mru.json',
-- backup file path (default: stdpath('data') .. '/nvim-mru-backup.json')
mru_backup_file = vim.fn.stdpath('data') .. '/nvim-mru-backup.json',
-- table of regex to ignore paths (default: {})
ignore_path_regexs = { '/.git/' },
-- enable logger.nvim (default: false, requires wsdjeg/logger.nvim)
enable_logger = false,
-- sort strategy: `lastenter`, `lastread`, `lastmod`, or `frecency`
-- default: `lastenter`
sort_by = 'lastenter',
})
โ๏ธ Basic Usage
Commands
| Command | Description |
|---|---|
:Mru | List MRU files in the quickfix window |
:Mru remove {re} | Remove files matching regex from the MRU list |
API
| Function | Description |
|---|---|
require('mru').setup(opt) | Initialize the plugin with options |
require('mru').get() | Returns a sorted list of MRU file paths |
require('mru').clear() | Backup current list to backup file, then clear |
require('mru').recover() | Restore MRU list from backup file |
require('mru').remove(regex) | Remove files matching regex from MRU list |
require('mru').calculate_frecentcy(f) | Calculate frecency score for a file |
Quickfix
Run :Mru to list all MRU files in the quickfix window:
:Mru
Remove files matching a regex pattern:
:Mru remove \.tmp$
Or via Lua API:
require('mru').remove('\\.tmp$')
Picker mru
mru.nvim provides a source for picker.nvim,
which can be opened via :Picker mru.
Key bindings for picker mru extension:
| Key Binding | Description |
|---|---|
<Enter> | Open file in the current window |
<C-s> | Open file in a horizontal split window |
<C-v> | Open file in a vertical split window |
<C-t> | Open file in a new tab |
vim.api.nvim_set_keymap('n', '<leader>m', ':Picker mru<CR>', { noremap = true, silent = true })
Telescope mru
mru.nvim also provides a telescope.nvim extension:
vim.api.nvim_set_keymap('n', '<leader>m', ':Telescope mru<CR>', { noremap = true, silent = true })
Now, pressing <leader>m (e.g., \m by default) will open the MRU list.
๐ฃ Self-Promotion
Like this plugin? Star the repository on GitHub.
Love this plugin? Follow me on GitHub.
๐ License
This project is licensed under the GPL-3.0 License.