mru.nvim

July 14, 2026 ยท View on GitHub

Run Tests GitHub License GitHub Issues or Pull Requests GitHub commit activity GitHub Release luarocks

A lightweight Neovim plugin to manage and display your Most Recently Used (MRU) files.

๐Ÿ“˜ 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:oldfiles may 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, or frecency.
  • 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

CommandDescription
:MruList MRU files in the quickfix window
:Mru remove {re}Remove files matching regex from the MRU list

API

FunctionDescription
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 BindingDescription
<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.