mru.vim 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. " File: mru.vim
  2. " Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
  3. " Version: 2.3
  4. " Last Modified: June 3, 2006
  5. "
  6. " Overview
  7. " --------
  8. " The Most Recently Used (MRU) plugin provides an easy access to a list of
  9. " recently opened/edited files in Vim. This plugin automatically stores the
  10. " file names as you open/edit them in Vim.
  11. "
  12. " This plugin will work on all the platforms where Vim is supported. This
  13. " plugin will work in both console and GUI Vim.
  14. "
  15. " The recently used filenames are stored in a file specified by the Vim
  16. " MRU_File variable.
  17. "
  18. " Installation
  19. " ------------
  20. " 1. Copy the mru.vim script to the $HOME/.vim/plugin or the
  21. " $HOME/vimfiles/plugin or the $VIM/vimfiles directory. Refer to the
  22. " ':help add-plugin', ':help add-global-plugin' and ':help runtimepath'
  23. " topics for more details about Vim plugins.
  24. " 2. Set the MRU_File Vim variable in the .vimrc file to the location of a
  25. " file to store the most recently edited file names.
  26. " 3. Restart Vim.
  27. " 4. You can use the ":MRU" command to list and edit the recently used files.
  28. " In GUI Vim, you can use the 'File->Recent Files' menu to access the
  29. " recently used files.
  30. "
  31. " Usage
  32. " -----
  33. " You can use the ":MRU" command to list all the most recently edited file
  34. " names. The file names will be listed in a temporary Vim window. If the MRU
  35. " window is already opened, then the MRU list displayed in the window will be
  36. " refreshed.
  37. "
  38. " If you are using GUI Vim, then the names of the recently edited files are
  39. " added to the "File->Recent Files" menu. You can select the name of a file
  40. " from this sub-menu to edit the file.
  41. "
  42. " You can use the normal Vim commands to move around the MRU window. You
  43. " cannot make changes in the MRU window.
  44. "
  45. " You can select a file name to edit by pressing the <Enter> key or by double
  46. " clicking the left mouse button on a file name. The selected file will be
  47. " opened.
  48. "
  49. " You can press the 'o' key to open the file name under the cursor in the
  50. " MRU window in a new window.
  51. "
  52. " You can press the 'u' key in the MRU window to update the file list. This is
  53. " useful if you keep the MRU window open.
  54. "
  55. " You can close the MRU window by pressing the 'q' key or using one of the Vim
  56. " window commands.
  57. "
  58. " You can use the ":MRUedit" command to edit files from the MRU list. This
  59. " command supports completion of file names from the MRU list. You can specify
  60. " the file either by the name or by the location in the MRU list.
  61. "
  62. " Whenever the MRU list changes, the MRU file is updated with the latest MRU
  63. " list. When you have multiple instances of Vim running at the same time, the
  64. " latest MRU list will show up in all the instances of Vim.
  65. "
  66. " Configuration
  67. " -------------
  68. " By changing the following variables you can configure the behavior of this
  69. " plugin. Set the following variables in your .vimrc file using the 'let'
  70. " command.
  71. "
  72. " The list of recently edit file names is stored in the file specified by the
  73. " MRU_File variable. The default setting for this variable is
  74. " $HOME/.vim_mru_files for Unix systems and $VIM/_vim_mru_files for non-Unix
  75. " systems. You can change this variable to point to a file by adding the
  76. " following line to the .vimrc file:
  77. "
  78. " let MRU_File = 'd:\myhome\_vim_mru_files'
  79. "
  80. " By default, the plugin will remember the names of the last 10 used files.
  81. " As you edit more files, old file names will be removed from the MRU list.
  82. " You can set the 'MRU_Max_Entries' variable to remember more file names. For
  83. " example, to remember 20 most recently used file names, you can use
  84. "
  85. " let MRU_Max_Entries = 20
  86. "
  87. " By default, all the edited file names will be added to the MRU list. If you
  88. " want to exclude file names matching a list of patterns, you can set the
  89. " MRU_Exclude_Files variable to a list of Vim regular expressions. By default,
  90. " this variable is set to an empty string. For example, to not include files
  91. " in the temporary (/tmp, /var/tmp and d:\temp) directories, you can set the
  92. " MRU_Exclude_Files variable to
  93. "
  94. " let MRU_Exclude_Files = '^/tmp/.*\|^/var/tmp/.*' " For Unix
  95. " let MRU_Exclude_Files = '^c:\\temp\\.*' " For MS-Windows
  96. "
  97. " The specified pattern should be a Vim regular expression pattern.
  98. "
  99. " The default height of the MRU window is 8. You can set the MRU_Window_Height
  100. " variable to change the window height.
  101. "
  102. " let MRU_Window_Height = 15
  103. "
  104. " By default, when the :MRU command is invoked, the MRU list will be displayed
  105. " in a new window. Instead, if you want the MRU plugin to reuse the current
  106. " window, then you can set the 'MRU_Use_Current_Window' variable to one.
  107. "
  108. " let MRU_Use_Current_Window = 1
  109. "
  110. " The MRU plugin will reuse the current window. When a file name is selected,
  111. " the file is also opened in the current window.
  112. "
  113. " When you select a file from the MRU window, the MRU window will be
  114. " automatically closed and the selected file will be opened in the previous
  115. " window. You can set the 'MRU_Auto_Close' variable to zero to keep the MRU
  116. " window open.
  117. "
  118. " let MRU_Auto_Close = 0
  119. "
  120. " ****************** Do not modify after this line ************************
  121. if exists('loaded_mru')
  122. finish
  123. endif
  124. let loaded_mru=1
  125. " Line continuation used here
  126. let s:cpo_save = &cpo
  127. set cpo&vim
  128. " Maximum number of entries allowed in the MRU list
  129. if !exists('MRU_Max_Entries')
  130. let MRU_Max_Entries = 10
  131. endif
  132. " Files to exclude from the MRU list
  133. if !exists('MRU_Exclude_Files')
  134. let MRU_Exclude_Files = ''
  135. endif
  136. " Height of the MRU window
  137. " Default height is 8
  138. if !exists('MRU_Window_Height')
  139. let MRU_Window_Height = 8
  140. endif
  141. if !exists('MRU_Use_Current_Window')
  142. let MRU_Use_Current_Window = 0
  143. endif
  144. if !exists('MRU_Auto_Close')
  145. let MRU_Auto_Close = 1
  146. endif
  147. if !exists('MRU_File')
  148. if has('unix')
  149. let MRU_File = $HOME . "/.vim_mru_files"
  150. else
  151. let MRU_File = $VIM . "/_vim_mru_files"
  152. endif
  153. endif
  154. " MRU_LoadList
  155. " Load the latest MRU file list from the MRU file
  156. function! s:MRU_LoadList()
  157. " Read the list from the MRU file.
  158. if filereadable(g:MRU_File)
  159. exe "source " . escape(g:MRU_File, ' ')
  160. endif
  161. if exists('g:MRU_files')
  162. " Replace file separator (|) with newline
  163. let s:MRU_files = substitute(g:MRU_files, "|", "\n", "g")
  164. unlet! g:MRU_files
  165. else
  166. let s:MRU_files = ''
  167. endif
  168. " Refresh the MRU menu
  169. call s:MRU_Refresh_Menu()
  170. endfunction
  171. " MRU_SaveList
  172. " Save the MRU list to the file
  173. function! s:MRU_SaveList()
  174. " Replace all newlines with file separator (|)
  175. let mru_list = substitute(s:MRU_files, "\n", "|", "g")
  176. " Escape single quote in filenames with double single quotes
  177. let mru_list = substitute(mru_list, "'", "''", "g")
  178. " set the verbose option to zero (default). Otherwise this will
  179. " mess up the text emitted below.
  180. let old_verbose = &verbose
  181. set verbose&vim
  182. " Clear the messages displayed on the status line
  183. echo
  184. " Save the MRU list
  185. exe "redir! > " . g:MRU_File
  186. silent! echon '" Most recently edited files in Vim (auto-generated)' . "\n"
  187. silent! echon "let MRU_files='" . mru_list . "'\n"
  188. redir END
  189. " Restore the verbose setting
  190. let &verbose = old_verbose
  191. endfunction
  192. " MRU_RemoveLines()
  193. " Remove the lines matching 'one_line' from 'str'
  194. function! s:MRU_RemoveLines(str, one_line)
  195. let idx = stridx(a:str, a:one_line . "\n")
  196. if idx == -1
  197. " one_line is not present in str
  198. return a:str
  199. endif
  200. let x = a:str
  201. while idx != -1
  202. " Remove the entry from the list by extracting the text before it
  203. " and then the text after it and then concatenate them
  204. let text_before = strpart(x, 0, idx)
  205. let rem_text = strpart(x, idx)
  206. let next_idx = stridx(rem_text, "\n")
  207. let text_after = strpart(rem_text, next_idx + 1)
  208. let x = text_before . text_after
  209. let idx = stridx(x, a:one_line . "\n")
  210. endwhile
  211. return x
  212. endfunction
  213. " MRU_TrimLines()
  214. " Returns the first "lcnt" lines from "lines"
  215. function! s:MRU_TrimLines(lines, lcnt)
  216. " Retain only lcnt lines in lines. Remove the remaining lines
  217. let llist = a:lines
  218. let cnt = a:lcnt
  219. let new_llist = ''
  220. while cnt > 0 && llist != ''
  221. " Extract one filename from the list
  222. let one_line = strpart(llist, 0, stridx(llist, "\n"))
  223. " Remove the extracted line from the list
  224. let llist = strpart(llist, stridx(llist, "\n") + 1)
  225. if one_line != ''
  226. " Retain the line (if non-empty)
  227. let new_llist = new_llist . one_line . "\n"
  228. endif
  229. " One more entry used up
  230. let cnt = cnt - 1
  231. endwhile
  232. return new_llist
  233. endfunction
  234. " MRU_AddFile
  235. " Add a file to the MRU file list
  236. function! s:MRU_AddFile(filename)
  237. if a:filename == ''
  238. return
  239. endif
  240. " Get the full path to the filename
  241. let fname = fnamemodify(a:filename, ':p')
  242. " Skip temporary buffer with buftype set
  243. if &buftype != ''
  244. return
  245. endif
  246. if g:MRU_Exclude_Files != ''
  247. " Do not add files matching the pattern specified in the
  248. " MRU_Exclude_Files to the MRU list
  249. if fname =~? g:MRU_Exclude_Files
  250. return
  251. endif
  252. endif
  253. " If the filename is already present in the MRU list, then move
  254. " it to the beginning of the list
  255. let idx = stridx(s:MRU_files, fname . "\n")
  256. if idx == -1 && !filereadable(fname)
  257. " File is not readable and is not in the MRU list
  258. return
  259. endif
  260. " Load the latest MRU file list
  261. call s:MRU_LoadList()
  262. " Remove the new file name from the existing MRU list (if already present)
  263. let old_flist = s:MRU_RemoveLines(s:MRU_files, fname)
  264. " Add the new file list to the beginning of the updated old file list
  265. let s:MRU_files = fname . "\n" . old_flist
  266. " Return the trimmed list
  267. let s:MRU_files = s:MRU_TrimLines(s:MRU_files, g:MRU_Max_Entries)
  268. " Save the updated MRU list
  269. call s:MRU_SaveList()
  270. " Refresh the MRU menu
  271. call s:MRU_Refresh_Menu()
  272. " If the MRU window is open, update the displayed MRU list
  273. let bname = '__MRU_Files__'
  274. let winnum = bufwinnr(bname)
  275. if winnum != -1
  276. let cur_winnr = winnr()
  277. call s:MRU_Open_Window()
  278. if winnr() != cur_winnr
  279. exe cur_winnr . 'wincmd w'
  280. endif
  281. endif
  282. endfunction
  283. " MRU_Edit_File
  284. " Edit the specified file
  285. function! s:MRU_Edit_File(filename)
  286. let fname = escape(a:filename, ' ')
  287. " If the file is already open in one of the windows, jump to it
  288. let winnum = bufwinnr('^' . fname . '$')
  289. if winnum != -1
  290. if winnum != winnr()
  291. exe winnum . 'wincmd w'
  292. endif
  293. else
  294. if &modified
  295. " Current buffer has unsaved changes, so open the file in a
  296. " new window
  297. exe 'split ' . fname
  298. else
  299. exe 'edit ' . fname
  300. endif
  301. endif
  302. endfunction
  303. " MRU_Window_Edit_File
  304. " Open a file selected from the MRU window
  305. function! s:MRU_Window_Edit_File(new_window)
  306. let fname = getline('.')
  307. if fname == ''
  308. return
  309. endif
  310. let fname = escape(fname, ' ')
  311. if a:new_window
  312. " Edit the file in a new window
  313. exe 'leftabove new ' . fname
  314. if g:MRU_Auto_Close == 1 && g:MRU_Use_Current_Window == 0
  315. " Go back to the MRU window and close it
  316. let cur_winnr = winnr()
  317. wincmd p
  318. silent! close
  319. if winnr() != cur_winnr
  320. exe cur_winnr . 'wincmd w'
  321. endif
  322. endif
  323. else
  324. " If the selected file is already open in one of the windows,
  325. " jump to it
  326. let winnum = bufwinnr('^' . fname . '$')
  327. if winnum != -1
  328. if g:MRU_Auto_Close == 1 && g:MRU_Use_Current_Window == 0
  329. " Automatically close the window if the file window is
  330. " not used to display the MRU list.
  331. silent! close
  332. endif
  333. " As the window numbers will change after closing a window,
  334. " get the window number again and jump to it, if the cursor
  335. " is not already in that window
  336. let winnum = bufwinnr('^' . fname . '$')
  337. if winnum != winnr()
  338. exe winnum . 'wincmd w'
  339. endif
  340. else
  341. if g:MRU_Auto_Close == 1 && g:MRU_Use_Current_Window == 0
  342. " Automatically close the window if the file window is
  343. " not used to display the MRU list.
  344. silent! close
  345. " Jump to the window from which the MRU window was opened
  346. if exists('s:MRU_last_buffer')
  347. let last_winnr = bufwinnr(s:MRU_last_buffer)
  348. if last_winnr != -1 && last_winnr != winnr()
  349. exe last_winnr . 'wincmd w'
  350. endif
  351. endif
  352. else
  353. if g:MRU_Use_Current_Window == 0
  354. " Goto the previous window
  355. " If MRU_Use_Current_Window is set to one, then the
  356. " current window is used to open the file
  357. wincmd p
  358. endif
  359. endif
  360. " Edit the file
  361. if &modified
  362. exe 'split ' . fname
  363. else
  364. exe 'edit ' . fname
  365. endif
  366. endif
  367. endif
  368. endfunction
  369. " MRU_Open_Window
  370. " Display the Most Recently Used file list in a temporary window.
  371. function! s:MRU_Open_Window()
  372. " Load the latest MRU file list
  373. call s:MRU_LoadList()
  374. " Empty MRU list
  375. if s:MRU_files == ''
  376. echohl WarningMsg | echo 'MRU file list is empty' | echohl None
  377. return
  378. endif
  379. " Save the current buffer number. This is used later to open a file when a
  380. " entry is selected from the MRU window. The window number is not saved,
  381. " as the window number will change when new windows are opened.
  382. let s:MRU_last_buffer = bufnr('%')
  383. let bname = '__MRU_Files__'
  384. " If the window is already open, jump to it
  385. let winnum = bufwinnr(bname)
  386. if winnum != -1
  387. if winnr() != winnum
  388. " If not already in the window, jump to it
  389. exe winnum . 'wincmd w'
  390. endif
  391. setlocal modifiable
  392. " Delete the contents of the buffer to the black-hole register
  393. silent! %delete _
  394. else
  395. if g:MRU_Use_Current_Window
  396. " Reuse the current window
  397. "
  398. " If the __MRU_Files__ buffer exists, then reuse it. Otherwise open
  399. " a new buffer
  400. let bufnum = bufnr(bname)
  401. if bufnum == -1
  402. let cmd = 'edit ' . bname
  403. else
  404. let cmd = 'buffer ' . bufnum
  405. endif
  406. exe cmd
  407. if bufnr('%') != bufnr(bname)
  408. " Failed to edit the MRU buffer
  409. return
  410. endif
  411. else
  412. " Open a new window at the bottom
  413. " If the __MRU_Files__ buffer exists, then reuse it. Otherwise open
  414. " a new buffer
  415. let bufnum = bufnr(bname)
  416. if bufnum == -1
  417. let wcmd = bname
  418. else
  419. let wcmd = '+buffer' . bufnum
  420. endif
  421. exe 'silent! botright ' . g:MRU_Window_Height . 'split ' . wcmd
  422. endif
  423. endif
  424. " Mark the buffer as scratch
  425. setlocal buftype=nofile
  426. setlocal bufhidden=delete
  427. setlocal noswapfile
  428. setlocal nowrap
  429. setlocal nobuflisted
  430. " Use fixed height for the MRU window
  431. if v:version >= 602
  432. setlocal winfixheight
  433. endif
  434. " Setup the cpoptions properly for the maps to work
  435. let old_cpoptions = &cpoptions
  436. set cpoptions&vim
  437. " Create a mapping to jump to the file
  438. nnoremap <buffer> <silent> <CR> :call <SID>MRU_Window_Edit_File(0)<CR>
  439. nnoremap <buffer> <silent> o :call <SID>MRU_Window_Edit_File(1)<CR>
  440. nnoremap <buffer> <silent> u :MRU<CR>
  441. nnoremap <buffer> <silent> <2-LeftMouse>
  442. \ :call <SID>MRU_Window_Edit_File(0)<CR>
  443. nnoremap <buffer> <silent> q :close<CR>
  444. " Restore the previous cpoptions settings
  445. let &cpoptions = old_cpoptions
  446. " Display the MRU list
  447. silent! 0put =s:MRU_files
  448. " Move the cursor to the beginning of the file
  449. exe 1
  450. setlocal nomodifiable
  451. endfunction
  452. " MRU_Edit_Complete
  453. " Command-line completion function used by :MRUedit command
  454. function! s:MRU_Edit_Complete(ArgLead, CmdLine, CursorPos)
  455. " Return the list of MRU files
  456. return s:MRU_files
  457. endfunction
  458. " MRU_Edit_File_Cmd
  459. " Function to handle the MRUedit command
  460. function! s:MRU_Edit_File_Cmd(fspec)
  461. if a:fspec == ''
  462. return
  463. endif
  464. " Load the latest MRU file
  465. call s:MRU_LoadList()
  466. " User can specify either a number of a partial file name to
  467. " edit a file from the MRU list
  468. if a:fspec =~ '\d\+'
  469. " A number is specified
  470. let fnum = a:fspec
  471. if fnum > g:MRU_Max_Entries
  472. echohl WarningMsg
  473. echo 'Maximum number of entries in MRU list = ' .
  474. \ g:MRU_Max_Entries
  475. echohl None
  476. return
  477. endif
  478. let mru_list = s:MRU_files
  479. let i = 1
  480. while mru_list != '' && i < fnum
  481. let one_fname = strpart(mru_list, 0, stridx(mru_list, "\n"))
  482. if one_fname == ''
  483. break
  484. endif
  485. let mru_list = strpart(mru_list, stridx(mru_list, "\n") + 1)
  486. let i = i + 1
  487. endwhile
  488. if i == fnum
  489. let fname = strpart(mru_list, 0, stridx(mru_list, "\n"))
  490. if fname != ''
  491. call s:MRU_Edit_File(fname)
  492. endif
  493. endif
  494. else
  495. " Locate the file name matching the supplied partial name
  496. let mru_list = s:MRU_files
  497. let fname = ''
  498. let fname_cnt = 0
  499. while mru_list != ''
  500. let one_fname = strpart(mru_list, 0, stridx(mru_list, "\n"))
  501. if one_fname == ''
  502. break
  503. endif
  504. if one_fname =~? a:fspec
  505. let fname = one_fname
  506. let fname_cnt = fname_cnt + 1
  507. endif
  508. let mru_list = strpart(mru_list, stridx(mru_list, "\n") + 1)
  509. endwhile
  510. if fname_cnt == 0
  511. echohl WarningMsg
  512. echo 'No matching file for ' . a:fspec
  513. echohl None
  514. return
  515. endif
  516. if fname_cnt > 1
  517. echohl WarningMsg
  518. echo 'More than one match for ' . a:fspec
  519. echohl None
  520. return
  521. endif
  522. call s:MRU_Edit_File(fname)
  523. endif
  524. endfunction
  525. " MRU_Refresh_Menu()
  526. " Refresh the MRU menu
  527. function! s:MRU_Refresh_Menu()
  528. if !has('gui_running') || &guioptions !~ 'm'
  529. " Not running in GUI mode
  530. return
  531. endif
  532. " Setup the cpoptions properly for the maps to work
  533. let old_cpoptions = &cpoptions
  534. set cpoptions&vim
  535. " Remove the MRU menu
  536. " To retain the teared-off MRU menu, we need to add a dummy entry
  537. silent! unmenu &File.Recent\ Files
  538. noremenu &File.Recent\ Files.Dummy <Nop>
  539. silent! unmenu! &File.Recent\ Files
  540. anoremenu <silent> &File.Recent\ Files.Refresh\ list
  541. \ :call <SID>MRU_LoadList()<CR>
  542. anoremenu File.Recent\ Files.-SEP1- :
  543. " Add the filenames in the MRU list to the menu
  544. let flist = s:MRU_files
  545. while flist != ''
  546. " Extract one filename from the list
  547. let fname = strpart(flist, 0, stridx(flist, "\n"))
  548. if fname == ''
  549. break
  550. endif
  551. " Escape special characters in the filename
  552. let esc_fname = escape(fnamemodify(fname, ':t'), ". \\|\t")
  553. " Remove the extracted line from the list
  554. let flist = strpart(flist, stridx(flist, "\n") + 1)
  555. " Truncate the directory name if it is long
  556. let dir_name = fnamemodify(fname, ':h')
  557. let len = strlen(dir_name)
  558. " Shorten long file names by adding only few characters from
  559. " the beginning and end.
  560. if len > 30
  561. let dir_name = strpart(dir_name, 0, 10) .
  562. \ '...' .
  563. \ strpart(dir_name, len - 20)
  564. endif
  565. let esc_dir_name = escape(dir_name, ". \\|\t")
  566. exe 'anoremenu <silent> &File.Recent\ Files.' . esc_fname .
  567. \ '\ (' . esc_dir_name . ')' .
  568. \ " :call <SID>MRU_Edit_File('" . fname . "')<CR>"
  569. endwhile
  570. " Remove the dummy menu entry
  571. unmenu &File.Recent\ Files.Dummy
  572. " Restore the previous cpoptions settings
  573. let &cpoptions = old_cpoptions
  574. endfunction
  575. " Load the MRU list on plugin startup
  576. call s:MRU_LoadList()
  577. " Autocommands to detect the most recently used files
  578. autocmd BufRead * call s:MRU_AddFile(expand('<afile>'))
  579. autocmd BufNewFile * call s:MRU_AddFile(expand('<afile>'))
  580. autocmd BufWritePost * call s:MRU_AddFile(expand('<afile>'))
  581. " Command to open the MRU window
  582. command! -nargs=0 MRU call s:MRU_Open_Window()
  583. command! -nargs=1 -complete=custom,s:MRU_Edit_Complete MRUedit
  584. \ call s:MRU_Edit_File_Cmd(<q-args>)
  585. " restore 'cpo'
  586. let &cpo = s:cpo_save
  587. unlet s:cpo_save