Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Plugin to manage Most Recently Used (MRU) files

NotificationsYou must be signed in to change notification settings

vim-scripts/mru.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 

Repository files navigation

This is a mirror ofhttp://www.vim.org/scripts/script.php?script_id=521OverviewThe Most Recently Used (MRU) plugin provides an easy access to a list ofrecently opened/edited files in Vim. This plugin automatically stores thefile names as you open/edit them in Vim.This plugin will work on all the platforms where Vim is supported. Thisplugin will work in both console and GUI Vim. This version of the MRUplugin needs Vim 7.0 and above. If you are using an earlier version ofVim, then you should use an older version of the MRU plugin.The recently used filenames are stored in a file specified by the VimMRU_File variable.The Github repository for the MRU plugin is available at:http://github.com/yegappan/mruUsageTo 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.  Ifthe MRU window is already opened, then the MRU list displayed in the windowis refreshed.If you are using GUI Vim, then the names of the recently edited files areadded to the "File->Recent Files" menu. You can select the name of a filefrom this sub-menu to edit the file.You can use the normal Vim commands to move around in the MRU window. Youcannot make changes in the MRU window.You can select a file name to edit by pressing the <Enter> key or by doubleclicking the left mouse button on a file name.  The selected file will beopened. If the file is already opened in a window, the cursor will be movedto that window. Otherwise, the file is opened in the previous window. If theprevious window has a modified buffer or is the preview window or is used bysome 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 theMRU 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 thefile is already opened in a window in the current or in another tab, thenthe 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 beforepressing '<Enter>' or 'v' or 'o' or 't'. You can also visually (usinglinewise visual mode) select multiple filenames and invoke the commands toopen the files. Each selected file will be opened in a separate window ortab.You can press the 'u' key in the MRU window to update the file list. This isuseful if you keep the MRU window open always.You can close the MRU window by pressing the 'q' key or the <Esc> key orusing one of the Vim window commands.To display only files matching a pattern from the MRU list in the MRUwindow, you can specify a pattern to the ":MRU" command. For example, todisplay only file names matching "vim" in them, you can use the followingcommand ":MRU vim".  When you specify a partial file name and only onematching filename is found, then the ":MRU" command will edit that file.The ":MRU" command supports command-line completion of file names fromthe 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 thatafter typing the ":MRU" command, you have to enter a space before completingthe 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 isnot present in the MRU list). This is useful if you want to open a filepresent in the same directory as a file in the MRU list. You can use thecommand-line completion of the ":MRU" command to complete the full path of afile 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 MRUlist. When you have multiple instances of Vim running at the same time, thelatest MRU list will show up in all the instances of Vim.The MRUFilename syntax group is used to highlight the file names in the MRUwindow. By default, this syntax group is linked to the Identifier highlightgroup. You can change the highlight group by adding the following line inyour .vimrc:   highlight link MRUFileName LineNrThe MRU buffer uses the 'mru file type. You can use this file type to addcustom auto commands, syntax highlighting, etc.ConfigurationBy changing the following variables you can configure the behavior of thisplugin. 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 theMRU_File variable.  The default setting for this variable is$HOME/.vim_mru_files for Unix-like systems and $USERPROFILE/_vim_mru_filesfor MS-Windows systems. You can change this variable to point to a file byadding 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. Forexample, to remember 1000 most recently used file names, you can use      let MRU_Max_Entries = 1000By default, all the edited file names will be added to the MRU list. If youwant to exclude file names matching a list of patterns, you can set theMRU_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 filesin the temporary (/tmp, /var/tmp and d:\temp) directories, you can set theMRU_Exclude_Files variable to      let MRU_Exclude_Files = '^/tmp/.*\|^/var/tmp/.*'  " For Unix      let MRU_Exclude_Files = '^c:\\temp\\.*'           " For MS-WindowsThe specified pattern should be a Vim regular expression pattern.If you want to add only file names matching a set of patterns to the MRUlist, then you can set the MRU_Include_Files variable. This variable shouldbe 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 editedfilenames are added to the MRU list.The default height of the MRU window is 8. You can set the MRU_Window_Heightvariable to change the window height.      let MRU_Window_Height = 15By default, when the :MRU command is invoked, the MRU list will be displayedin a new window. Instead, if you want the MRU plugin to reuse the currentwindow, then you can set the 'MRU_Use_Current_Window' variable to one.      let MRU_Use_Current_Window = 1The 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 beautomatically closed and the selected file will be opened in the previouswindow. You can set the 'MRU_Auto_Close' variable to zero to keep the MRUwindow open.      let MRU_Auto_Close = 0If 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, themenu is enabled.      let MRU_Add_Menu = 0If too many file names are present in the MRU list, then updating the MRUmenu to list all the file names makes Vim slow. To avoid this, theMRU_Max_Menu_Entries variable controls the number of file names to show inthe MRU menu. By default, this is set to 10. You can change this to showmore entries in the menu.      let MRU_Max_Menu_Entries = 20If many file names are present in the MRU list, then the MRU menu is splitinto 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 thenumber of file names displayed in a single sub-menu:      let MRU_Max_Submenu_Entries = 15In the MRU window, the filenames are displayed in two parts. The first partcontains the file name without the path and the second part contains thefull path to the file in parenthesis. This format is controlled by theMRU_Filename_Format variable. If you prefer to change this to some otherformat, then you can modify the MRU_Filename_Format variable. For example,to display the full path without splitting it, you can set this variableas shown below:      let MRU_Filename_Format={'formatter':'v:val', 'parser':'.*'}

About

Plugin to manage Most Recently Used (MRU) files

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp