Vi/Vim restore opened files

Solution 1:

You can map using :mksession and :source to a set of keys for easy saving and restoring. Here's an example from my .vimrc that uses F2 and F3:

map <F2> :mksession! ~/vim_session <cr> " Quick write session with F2
map <F3> :source ~/vim_session <cr>     " And load session with F3

Solution 2:

Give a look at the :mksession command, to create a session:

A Session keeps the Views for all windows, plus the global settings. You can save a Session and when you restore it later the window layout looks the same. You can use a Session to quickly switch between different projects, automatically loading the files you were last working on in that project.