• Stars
    star
    149
  • Rank 248,619 (Top 5 %)
  • Language
    Vim Script
  • Created about 14 years ago
  • Updated almost 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Plugin to manage Most Recently Used (MRU) files
This is a mirror of http://www.vim.org/scripts/script.php?script_id=521

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.

You can press the 'o' key to open the file name under the cursor in the
MRU window in a new window. You can also press <Shift-Enter> instead of 'o'
to open the file in a new window.

To open a file from the MRU window in read-only mode (view), press the 'v'
key.

To open a file from the MRU window in a new tab, press the 't' key.  If the
file is already opened in a window in the current or in another tab, then
the cursor is moved to that tab. Otherwise, a new tab is opened.

You can open multiple files from the MRU window by specifying a count before
pressing '<Enter>' or 'v' or 'o' or 't'. You can also visually (using
linewise visual mode) select multiple filenames and invoke the commands to
open the files. Each selected file will be opened in a separate window or
tab.

You can press the 'u' key in the MRU window to update the file list. This is
useful if you keep the MRU window open always.

You can close the MRU window by pressing the 'q' key or the <Esc> key or
using one of the Vim window commands.

To display only files matching a pattern from the MRU list in the MRU
window, you can specify a pattern to the ":MRU" command. For example, to
display only file names matching "vim" in them, you can use the following
command ":MRU vim".  When you specify a partial file name and only one
matching filename is found, then the ":MRU" command will edit that file.

The ":MRU" command supports command-line completion of file names from
the MRU list. You can enter a partial file name and then press <Tab>
or <Ctrl-D> to complete or list all the matching file names. Note that
after typing the ":MRU" command, you have to enter a space before completing
the file names with <Tab>.

When a file supplied to the ":MRU" command is not present in the MRU list,
but it is a readable file, then the file will be opened (even though it is
not present in the MRU list). This is useful if you want to open a file
present in the same directory as a file in the MRU list. You can use the
command-line completion of the ":MRU" command to complete the full path of a
file and then modify the path to open another file present in the same path.

Whenever the MRU list changes, the MRU file is updated with the latest MRU
list. When you have multiple instances of Vim running at the same time, the
latest MRU list will show up in all the instances of Vim.

The MRUFilename syntax group is used to highlight the file names in the MRU
window. By default, this syntax group is linked to the Identifier highlight
group. You can change the highlight group by adding the following line in
your .vimrc:

   highlight link MRUFileName LineNr

The MRU buffer uses the 'mru file type. You can use this file type to add
custom auto commands, syntax highlighting, etc.

Configuration

By changing the following variables you can configure the behavior of this
plugin. Set the following variables in your .vimrc file using the 'let'
command.

The list of recently edited file names is stored in the file specified by the
MRU_File variable.  The default setting for this variable is
$HOME/.vim_mru_files for Unix-like systems and $USERPROFILE/_vim_mru_files
for MS-Windows systems. You can change this variable to point to a file by
adding the following line to the .vimrc file:

      let MRU_File = 'd:\myhome\_vim_mru_files'

By default, the plugin will remember the names of the last 100 used files.
As you edit more files, old file names will be removed from the MRU list.
You can set the 'MRU_Max_Entries' variable to remember more file names. For
example, to remember 1000 most recently used file names, you can use

      let MRU_Max_Entries = 1000

By default, all the edited file names will be added to the MRU list. If you
want to exclude file names matching a list of patterns, you can set the
MRU_Exclude_Files variable to a list of Vim regular expressions. By default,
this variable is set to an empty string. For example, to not include files
in the temporary (/tmp, /var/tmp and d:\temp) directories, you can set the
MRU_Exclude_Files variable to

      let MRU_Exclude_Files = '^/tmp/.*\|^/var/tmp/.*'  " For Unix
      let MRU_Exclude_Files = '^c:\\temp\\.*'           " For MS-Windows

The specified pattern should be a Vim regular expression pattern.

If you want to add only file names matching a set of patterns to the MRU
list, then you can set the MRU_Include_Files variable. This variable should
be set to a Vim regular expression pattern. For example, to add only .c and
.h files to the MRU list, you can set this variable as below:

      let MRU_Include_Files = '\.c$\|\.h$'

By default, MRU_Include_Files is set to an empty string and all the edited
filenames are added to the MRU list.

The default height of the MRU window is 8. You can set the MRU_Window_Height
variable to change the window height.

      let MRU_Window_Height = 15

By default, when the :MRU command is invoked, the MRU list will be displayed
in a new window. Instead, if you want the MRU plugin to reuse the current
window, then you can set the 'MRU_Use_Current_Window' variable to one.

      let MRU_Use_Current_Window = 1

The MRU plugin will reuse the current window. When a file name is selected,
the file is also opened in the current window.

When you select a file from the MRU window, the MRU window will be
automatically closed and the selected file will be opened in the previous
window. You can set the 'MRU_Auto_Close' variable to zero to keep the MRU
window open.

      let MRU_Auto_Close = 0

If you don't use the "File->Recent Files" menu and want to disable it,
then you can set the 'MRU_Add_Menu' variable to zero. By default, the
menu is enabled.

      let MRU_Add_Menu = 0

If too many file names are present in the MRU list, then updating the MRU
menu to list all the file names makes Vim slow. To avoid this, the
MRU_Max_Menu_Entries variable controls the number of file names to show in
the MRU menu. By default, this is set to 10. You can change this to show
more entries in the menu.

      let MRU_Max_Menu_Entries = 20

If many file names are present in the MRU list, then the MRU menu is split
into sub-menus. Each sub-menu contains MRU_Max_Submenu_Entries file names.
The default setting for this is 10. You can change this to increase the
number of file names displayed in a single sub-menu:

      let MRU_Max_Submenu_Entries = 15

In the MRU window, the filenames are displayed in two parts. The first part
contains the file name without the path and the second part contains the
full path to the file in parenthesis. This format is controlled by the
MRU_Filename_Format variable. If you prefer to change this to some other
format, then you can modify the MRU_Filename_Format variable. For example,
to display the full path without splitting it, you can set this variable
as shown below:

      let MRU_Filename_Format={'formatter':'v:val', 'parser':'.*'}

More Repositories

1

taglist.vim

Source code browser (supports C/C++, java, perl, python, tcl, sql, php, etc)
Vim Script
650
star
2

dbext.vim

Provides database access to many dbms (Oracle, Sybase, Microsoft, MySQL, DBI,..)
Vim Script
417
star
3

YankRing.vim

Maintains a history of previous yanks, changes and deletes
Vim Script
405
star
4

a.vim

Alternate Files quickly (.c --> .h etc)
Vim Script
302
star
5

DrawIt

Ascii drawing plugin: lines, ellipses, arrows, fills, and more!
Vim Script
293
star
6

ReplaceWithRegister

Replace text with the contents of a register.
Vim Script
291
star
7

Conque-GDB

GDB command line interface and terminal emulator in (G)Vim.
Python
275
star
8

AutoComplPop

Automatically opens popup menu for completions
Vim Script
263
star
9

FuzzyFinder

buffer/file/command/tag/etc explorer with fuzzy matching
Vim Script
258
star
10

Conque-Shell

Run interactive commands inside a Vim buffer
Vim Script
248
star
11

vim-auto-save

Automatically save changes to disk
Vim Script
225
star
12

vimwiki

Personal Wiki for Vim
Vim Script
195
star
13

ZoomWin

Zoom in/out of windows (toggle between one window and multi-window)
Vim Script
182
star
14

VimClojure

A filetype, syntax and indent plugin for Clojure
Vim Script
179
star
15

paredit.vim

Paredit Mode: Structured Editing of Lisp S-expressions
Vim Script
177
star
16

DoxygenToolkit.vim

Simplify Doxygen documentation in C, C++, Python.
Vim Script
162
star
17

c.vim

C/C++ IDE -- Write and run programs. Insert statements, idioms, comments etc.
Vim Script
152
star
18

matchit.zip

extended % matching for HTML, LaTeX, and many other languages
Vim Script
148
star
19

argtextobj.vim

Text-object like motion for arguments
Vim Script
138
star
20

Align

Help folks to align text, eqns, declarations, tables, etc
Vim Script
132
star
21

UltiSnips

The ultimate snippet solution for python enabled Vim.
Python
129
star
22

Vim-R-plugin

Plugin to work with R
Vim Script
126
star
23

slimv.vim

SLIME-like Lisp and Clojure REPL inside Vim with Profiling, Hyperspec, Paredit
Common Lisp
119
star
24

bufexplorer.zip

Buffer Explorer / Browser
Vim Script
111
star
25

TaskList.vim

Eclipse like task list
Vim Script
107
star
26

VimIM

Vim Input Method -- Vim 中文输入法
Vim Script
103
star
27

VOoM

Vim Outliner of Markers -- two-pane outliner and related utilities
Python
98
star
28

SQLUtilities

SQL utilities - Formatting, generate - columns lists, procedures for databases
Vim Script
91
star
29

bash-support.vim

BASH IDE -- Write and run BASH-scripts using menus and hotkeys.
Vim Script
90
star
30

netrw.vim

Network oriented reading, writing, and browsing (keywords: netrw ftp scp)
Vim Script
90
star
31

OmniCppComplete

C/C++ omni-completion with ctags database
Vim Script
89
star
32

LanguageTool

Grammar checker for English, French, German (etc.) in Vim
Vim Script
88
star
33

Pydiction

Tab-complete your Python code
Python
87
star
34

TwitVim

Twitter client for Vim
Vim Script
86
star
35

xoria256.vim

Finely tuned soft gamma, 256 colors, dark background, gvim == vim
Vim Script
84
star
36

indentpython.vim

An alternative indentation script for python
Vim Script
82
star
37

utl.vim

Univeral Text Linking - Execute URLs, footnotes, open emails, organize ideas
Vim Script
80
star
38

fcitx.vim

keep and restore fcitx state when leaving/re-entering insert mode
Vim Script
79
star
39

peaksea

Refined color, contains both gui and cterm256 for dark and light background
Vim Script
77
star
40

SyntaxRange

Define a different filetype syntax on regions of a buffer.
Vim Script
76
star
41

L9

Vim-script library
Vim Script
75
star
42

AnsiEsc.vim

ansi escape sequences concealed, but highlighted as specified (conceal)
Vim Script
72
star
43

LargeFile

Edit large files quickly (keywords: large huge speed)
Vim Script
72
star
44

JavaScript-Indent

Javascript indenter (HTML indent is included)
Vim Script
69
star
45

tComment

An extensible & universal comment plugin that also handles embedded filetypes
Vim Script
68
star
46

The-NERD-tree

A tree explorer plugin for navigating the filesystem
Vim Script
66
star
47

nginx.vim

initial version
Vim Script
65
star
48

camelcasemotion

Motion through CamelCaseWords and underscore_notation.
Vim Script
64
star
49

ShowMarks

Visually shows the location of marks.
Vim Script
64
star
50

closetag.vim

Functions and mappings to close open HTML/XML tags
Vim Script
64
star
51

BufOnly.vim

Delete all the buffers except the current/named buffer
Vim Script
63
star
52

bufkill.vim

Unload/delete/wipe a buffer, keep its window(s), display last accessed buffer(s)
Vim Script
62
star
53

vcscommand.vim

CVS/SVN/SVK/git/hg/bzr integration plugin
Vim Script
61
star
54

Auto-Pairs

Insert or delete brackets, parens, quotes in pair.
Vim Script
61
star
55

AutoClose

Inserts matching bracket, paren, brace or quote
Vim Script
61
star
56

Gundo

Visualize your undo tree.
Python
60
star
57

grep.vim

Grep search tools integration with Vim
Vim Script
56
star
58

javacomplete

Omni Completion for JAVA
Vim Script
56
star
59

SearchComplete

Tab completion of words inside of a search ('/')
Vim Script
55
star
60

VisIncr

Produce increasing/decreasing columns of numbers, dates, or daynames
Vim Script
55
star
61

EasyGrep

Fast and Easy Find and Replace Across Multiple Files
Vim Script
53
star
62

pep8

Check your python source files with PEP8
Vim Script
52
star
63

wombat256.vim

Wombat for 256 color xterms
Vim Script
48
star
64

sessionman.vim

Vim session manager
Vim Script
47
star
65

cscope.vim

create cscope database and connect to existing proper database automatically.
Vim Script
47
star
66

restore_view.vim

A plugin for automatically restoring file's cursor position and folding
Vim Script
46
star
67

Mark--Karkat

Highlight several words in different colors simultaneously. (#1238 continued)
Vim Script
46
star
68

loremipsum

A dummy text generator
Vim Script
45
star
69

ScrollColors

Colorsheme Scroller, Chooser, and Browser
Vim Script
45
star
70

gtags.vim

Integrates GNU GLOBAL source code tag system with VIM.
Vim Script
42
star
71

perl-support.vim

Perl IDE -- Write and run Perl-scripts using menus and hotkeys.
Vim Script
42
star
72

google.vim

Indent file for Google C++ Coding Style
Vim Script
41
star
73

winmanager

A windows style IDE for Vim 6.0
Vim Script
41
star
74

gitignore

Set 'wildignore' from ./.gitignore
Vim Script
40
star
75

sudo.vim

Allows one to edit a file with prevledges from an unprivledged session.
Vim Script
40
star
76

HTML-AutoCloseTag

Automatically closes HTML tags once you finish typing them.
Vim Script
39
star
77

greplace.vim

Replace a pattern across multiple files interactively
Vim Script
38
star
78

CSApprox

Make gvim-only colorschemes work transparently in terminal vim
Vim Script
38
star
79

phpfolding.vim

Automatic folding of PHP functions, classes,.. (also folds related PhpDoc)
Vim Script
38
star
80

SyntaxComplete

OMNI Completion based on the current syntax highlights
Vim Script
37
star
81

vis

Extended Visual Mode Commands, Substitutes, and Searches
Vim Script
36
star
82

snipMate

TextMate-style snippets for Vim
Vim Script
36
star
83

workflowish

ToDo manager plugin inspired by workflowy.com
Vim Script
34
star
84

VimRepress

Plugin for managing wordpress blog from Vim.
Vim Script
34
star
85

Lucius

Dark and light color scheme (GUI and 256 color terminal)
Vim Script
34
star
86

SQLComplete.vim

SQLComplete is a SQL code completion system using the omnifunc framework
Vim Script
34
star
87

Wombat

Dark gray color scheme sharing some similarities with Desert
Vim Script
33
star
88

DirDiff.vim

A plugin to diff and merge two directories recursively.
Vim Script
33
star
89

AutoTag

Updates entries in a tags file automatically when saving
Vim Script
33
star
90

TagHighlight

Extra highlighting of typedefs, enumerations etc (based on ctags)
Vim Script
32
star
91

Gist.vim

vimscript for gist
Vim Script
32
star
92

jsbeautify

a javascript source code formatter
Vim Script
32
star
93

The-NERD-Commenter

A plugin that allows for easy commenting of code for many filetypes.
Vim Script
32
star
94

marvim

Macro Persistent Storage and Shareable Repository for VIM
Vim Script
32
star
95

Python-mode-klen

python mode
Python
31
star
96

scratch.vim

Plugin to create and use a scratch Vim buffer
Vim Script
31
star
97

Emmet.vim

vim plugins for HTML and CSS hi-speed coding.
Vim Script
29
star
98

IndexedSearch

shows 'Nth match out of M' at every search (index of match+total # matches)
Vim Script
29
star
99

errormarker.vim

Highlights and sets error markers for lines with compile errors
Vim Script
29
star
100

TeTrIs.vim

A tetris game in pure vim
Vim Script
29
star