Skip to content

Instantly share code, notes, and snippets.

@dezza
Last active May 31, 2022 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dezza/e11a2825529011519e4588d170895f20 to your computer and use it in GitHub Desktop.
Save dezza/e11a2825529011519e4588d170895f20 to your computer and use it in GitHub Desktop.
Its magic πŸ§™β€β™‚οΈβ­
if has('viminfo') && !empty(&viminfo)
" Ignore paths, such as :help files
set viminfo+=r/usr/share/vim/vim81/doc
endif
set viminfofile=$HOME/.vim/viminfo
function! Oldfiles()
rviminfo!
enew
execute "0put =v:oldfiles"
normal! Gdd
set buftype=nofile
setlocal nomodifiable
setlocal nobuflisted
nnoremap <buffer> <CR> :e <C-r>=getline('.')<CR><CR><CR>:0<CR>
endfunction
nnoremap <leader>o :call Oldfiles()<CR>
if has('autocmd')
augroup vimrc
autocmd!
autocmd BufReadPost * wviminfo " Oldfiles()
augroup END
endif
" nnoremap <leader>o :call Oldfiles()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment