"Restore session" in gVim like in Firefox?
One possibility would be to run :mksession
periodically. Vim does not support timers as far as I know, but you could associate :mksession
to a :autocmd
event such as BufNewFile
.
A possible event to use in these cases is VimLeavePre
, e.g.:
autocmd VimLeavePre * mksession! .vim.sess
If you want another hint, or something that is more user friendly and asks you at start up if you want to load the session, you could give a try to http://www.vim.org/scripts/script.php?script_id=3150 . I use it and it works quite well for me. You can have multiple sessions and it is very user friendly. You can SaveSession, OpenSession, DeleteSession and the files are stored in .vim/sessions so that you can use still mksession if you want.