Use case:
You have 2-3 files displayed in your MacVim window(s). You press ctrl+Q and MacVim closes. When you restart MacVim it opens displaying the same files you had when you closed it.
How can you do that?
-- ANSWER
I added the following to my .vmirc
"save and close all files and save global session
nnoremap <leader>q :mksession! ~/.vim/Session.vim<CR>:wqa<CR>
"close all files without saving and save global session
nnoremap <leader>www :mksession! ~/.vim/Session.vim<CR>:qa!<CR>
function! RestoreSession()
if argc() == 0 "vim called without arguments
execute 'source ~/.vim/Session.vim'
end
endfunction
autocmd VimEnter * call RestoreSession()
With this I almost have the exact behavior I wanted, the only minor nuisance is that I still need to press command-q afterwards but that's MacOs, not vim....