How to save and restore multiple different sessions in Vim?

You might want to set these session options in your vimrc. Especially options is annoying when you've changed your vimrc after you've saved the session.

set ssop-=options    " do not store global and local values in a session
set ssop-=folds      " do not store folds

You want something like

:mksession ~/mysession.vim

Then later you can source that vim file and you'll have your old session back:

:source ~/mysession.vim

or open vim with the -S option:

$ vim -S ~/mysession.vim

Tags:

Vim

Session