Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save and restore multiple different sessions in Vim?

Tags:

vim

session

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

How can I save different sessions for later use?

like image 780
Jogusa Avatar asked Oct 29 '09 09:10

Jogusa


People also ask

How to save sessions in Vim?

So if you only want to have only one session saved in your current directory, you can use :mksession or :mks from vim to save your current session, and just vim -S to open it back up.

What is a vim session?

Vim sessions work by saving info about your open buffers, windows, and other stuff to a Vim script file on your disk in a location you specify. Later, you can load these things from that same file to restore your session just as you left it.

How do I save a vmware session?

You can save a session using the subroutine call syntax as follows: Vim::save_session():


2 Answers

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 
like image 142
Benj Avatar answered Sep 22 '22 23:09

Benj


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 
like image 25
Jan Christoph Avatar answered Sep 21 '22 23:09

Jan Christoph