sponsor Vim development Vim logo Vim Book Ad

mru.vim : Plugin to manage Most Recently Used (MRU) files

 script karma  Rating 1209/411, Downloaded by 34036  Comments, bugs, improvements  Vim wiki

created by
Yegappan Lakshmanan
 
script type
utility
 
description
Overview

The Most Recently Used (MRU) plugin provides an easy access to a list of
recently opened/edited files in Vim. This plugin automatically stores the
file names as you open/edit them in Vim.

This plugin will work on all the platforms where Vim is supported. This
plugin will work in both console and GUI Vim. This version of the MRU
plugin needs Vim 7.0 and above. If you are using an earlier version of
Vim, then you should use an older version of the MRU plugin.

The recently used filenames are stored in a file specified by the Vim
MRU_File variable.

The Github repository for the MRU plugin is available at:

      http://github.com/yegappan/mru

Usage

To list and edit files from the MRU list, you can use the ":MRU" command.
The ":MRU" command displays the MRU file list in a temporary Vim window.  If
the MRU window is already opened, then the MRU list displayed in the window
is refreshed.

If you are using GUI Vim, then the names of the recently edited files are
added to the "File->Recent Files" menu. You can select the name of a file
from this sub-menu to edit the file.

You can use the normal Vim commands to move around in the MRU window. You
cannot make changes in the MRU window.

You can select a file name to edit by pressing the <Enter> key or by double
clicking the left mouse button on a file name.  The selected file will be
opened. If the file is already opened in a window, the cursor will be moved
to that window. Otherwise, the file is opened in the previous window. If the
previous window has a modified buffer or is the preview window or is used by
some other plugin, then the file is opened in a new window.

The user manual is available at:

https://github.com/yegappan/mru/wiki/User-Manual
 
install details
1. Download the mru.zip file and expand the mru.zip file into the
    $HOME/.vim directory for Linux/MacOS/Unix systems or the
    HOMEPATH/vimfiles directory for MS-Windows.  After this
    step, you should have the following files (the directory structure
    should be preserved):

plugin/mru.vim - MRU plugin
doc/mru.txt    - documentation (help) file

3. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc directory, start Vim and
   run the ":helptags ." command to process the help file. Without this step,
   you cannot jump to the MRU help topics.
4. Restart Vim.
5. You can use the |:MRU| command to list and edit the recently used files.
   In GUI Vim, you can use the 'File->Recent Files' menu to access the
   recently used files.

To uninstall the MRU plugin, either use the uninstall command provided by the
plugin manager or manually remove the plugin/mru.vim, and doc/mru.txt
files from either the $HOME/.vim or $HOME/vimfiles directory.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
mru.zip 3.11 2022-08-21 7.0 Yegappan Lakshmanan 1. Update the MRU list every time a buffer is entered (BufEnter).
2. Add the MruGetFiles() function to return the List of MRU files. Can be used to execute Ex commands on the MRU list.
3. When loading a deleted buffer, make the buffer listed again.
4. Support using command modifiers (e.g. topleft) with the MRU command.
5. Add the :MRUToggle command to toggle the MRU window.
6. When the MRU file names are displayed in the current window, keep the alternate file when opening a file.
7. Add support for setting the alternate file to the first file in the MRU list (MRU_Set_Alternate_File).
8. Support opening encrypted files from the MRU list.
9. Search the files in the MRU list ignoring case.
10. Use the MRU window height for the FZF window.
11. Pass the "--no-sort" option to FZF to keep the MRU file order.
12. Refresh the MRU list before invoking FZF.
13. Use the FZF window layout for the FZFMru command.
mru.zip 3.10 2021-02-06 7.0 Yegappan Lakshmanan 1. Add support for fuzzy searching the MRU list (using matchfuzzy())
2. Add support for FZF integration
3. Add support for deleting a file from the MRU list
4. Expand the environment variables in the MRU_File variable.
5. When opening a file from the MRU window using 't', reuse the current tab page if it is empty.
6. Change the MRU buffer name to '-RecentFiles'
7. Add support for command modifiers in the :MRU command
8. Add support for specifying the MRU window height.
9. When opening existing buffers, use buffer commands to retain buffer-local settings.
mru.vim 3.9 2015-02-04 7.0 Yegappan Lakshmanan 1. Mapping for escape key breaks special key functionality in terminal Vim
2. Configurable syntax highlighting pattern (Ingo Karkat)
3. To open a file in a new tab page at the end, use $ instead of 999.
4. When opening a file from the MRU list, if the current buffer is modified and the 'hidden' option is set, then replace the current buffer. Otherwise open the file in a new window.
5. Updated the help text.
mru.vim 3.8 2014-03-09 7.0 Yegappan Lakshmanan 1. Add a mapping to open a file in the preview window (By Ingo Karkat)
2. Add support for changing the filename format in the MRU window (By Ingo Karkat)
3. Add new key bindings (By Ingo Karkat)
4. Mark the MRU buffer as modifiable always
5. Add syntax highlighting for file names
mru.vim 3.7 2013-12-22 7.0 Yegappan Lakshmanan 1. Use the fnameescape() function (if available) to escape special characters in file names.
mru.vim 3.6 2013-12-22 7.0 Yegappan Lakshmanan 1. When deleting the last empty line in the MRU buffer, use the black hole (_) register.
2. Set the filetype option for the MRU buffer to 'mru'.
3. When comparing strings, use '==#' instead of '==' to match case.
mru.vim 3.5 2013-05-08 7.0 Yegappan Lakshmanan First file in the MRU list is not added to the MRU menu. Fix a off-by-one error.
Used a wrong version of the plugin in the previous upload of 3.5. Fixed the problem.
mru.vim 3.4 2012-04-14 7.0 Yegappan Lakshmanan Separate the file name and the path in the MRU window.
Added support for always opening selected files in a tab (MRU_Open_File_Use_Tabs option).
Added support for opening the MRU window even for single files (MRU_Window_Open_Always option).
Added new mapping for opening files in a vertically split window from the MRU widow (key O).
mru.vim 3.3 2009-12-18 7.0 Yegappan Lakshmanan * Limit the number of file names displayed in the MRU menu. Provide a configuration variable for selecting the number of file names displayed in the MRU menu or in the sub-menu.
* Add a menu accelerator for the Recent Files menu.
* Add the ":Mru" command (alias for the ":MRU" command) for ease of use.
* When a file not present in the MRU list is supplied to the ":Mru" command, then open the file.
* Add 'v' command to edit a file from the MRU list as read-only.
* Increase the default MRU list size to 100 from 10.
* Support for opening multiple files from the MRU list.
mru.vim 3.2 2008-09-23 7.0 Yegappan Lakshmanan Escape special characters in filenames for security reasons. On MS-Windows, use the _vim_mru_files file from the $USERPROFILE directory. When the ':vimgrep' command is used, don't add the files to the MRU list. When getting the files matching a pattern, first try it as a literal string. Show tooltip text for MRU menu entries.
mru.vim 3.1 2008-02-17 7.0 Yegappan Lakshmanan Support for completion of filenames from the MRU file list for the :MRU command. Split the MRU menu into submenus when a large number of filenames are present in the MRU list. Fix for the placement of the MRU menu when Vim is running in compatible mode. New option to disable the MRU menu. The :MRUedit command is replaced by the :MRU command.
mru.vim 3.0 2008-01-12 7.0 Yegappan Lakshmanan Works only with Vim version 7.0 and above. Uses Vim 7.0 data structures and functions. Support for opening files in tabs. Support for displaying files matching a pattern in the MRU window.
mru.vim 2.5 2007-10-31 6.0 Yegappan Lakshmanan Use <abuf> instead of <afile> in autocmds. Escape backslash while searching for partial filenames.
mru.vim 2.4 2006-10-30 6.0 Yegappan Lakshmanan Escape the % and # characters in the MRU filenames. Don't open a selected file in the preview window or in a window used by a Vim plugin.
mru.vim 2.3 2006-06-03 6.0 Yegappan Lakshmanan Escape single quote characters in filenames. Use exact match while searching for open files.
mru.vim 2.2 2006-05-30 6.0 Yegappan Lakshmanan 1. Save the list of MRU files to the MRU db file as soon as the list is changed.
2. Escape space characters in file names.
3. Add the :MRUedit command to edit files from the MRU list.
mru.vim 2.1 2005-05-03 6.0 Yegappan Lakshmanan Fixed a problem with handling space characters in the name of the MRU file. Modified the plugin to work in Vi compatible mode.
mru.vim 2.0 2005-03-26 6.0 Yegappan Lakshmanan Fixed the problem with one Vim session overwritting the MRU list from another Vim session. Added the MRU file list to the File menu in GUI Vim. Instead of using a Vim global variable to store the MRU list, used a separate file to store the MRU list.
mru.vim 1.6 2003-07-19 6.0 Yegappan Lakshmanan Fixed the following bugs: Some filenames are added more than once to the MRU list and the MRU window is not closed when a file which already opened in one of the windows is selected from the MRU window.
mru.vim 1.5 2003-07-02 6.0 Yegappan Lakshmanan Open the selected file from the MRU list in the window from which the MRU window was opened.
ip used for rating: 35.168.113.41

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github