Working solution for FZF most recent files in Vim?

I found a latest Junegunn plugin.

Plug 'junegunn/fzf.vim'

It covers a case.

Just add

nmap <silent> <leader>m :History<CR>

Thanks Junegunn :)


One possible solution is to leverage the neomru plugin which will save your most recently visted files to a cache located at ~/.cache/neomru/file.

After installing the neomru plugin with your preferred plugin manager, you can define a mapping to search the cache file, for example:

nnoremap <silent> <Leader>m :call fzf#run({
\   'source': 'sed "1d" $HOME/.cache/neomru/file',
\   'sink': 'e '
\ })<CR>

Check out https://github.com/junegunn/fzf/wiki/Examples-(vim). Lots of cool stuff there, including MRU, tags search, and much more. Junegunn implemented MRU simply as:

command! FZFMru call fzf#run({
\  'source':  v:oldfiles,
\  'sink':    'e',
\  'options': '-m -x +s',
\  'down':    '40%'})