How to save and restore multiple different sessions in Vim?
Depending on my task in Vim I have several tabs open.
How can I save different sessions for later use?
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
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
Note that :mksession will not save the changes to any files that you've made. I made this mistake of closing vim after saving the session assuming that I'll take up from there. But next time I opened the session, the changes I had made to the files were gone.