配置文件加以下内容:
" Go to last file(s) if invoked without arguments.
autocmd VimLeave * nested if (!isdirectory($HOME . "/.vim")) |
\ call mkdir($HOME . "/.vim") |
\ endif |
\ execute "mksession! " . $HOME . "/.vim/Session.vim"
autocmd VimEnter * nested if argc() == 0 && filereadable($HOME . "/.vim/Session.vim") |
\ execute "source " . $HOME . "/.vim/Session.vim"
参考:Open the last edited file