How to save and restore multiple different sessions in Vim?

Jogusa picture Jogusa · Oct 29, 2009 · Viewed 87.2k times · Source

Depending on my task in Vim I have several tabs open.

How can I save different sessions for later use?

Answer

Benj picture Benj · Oct 29, 2009

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