Alot of times I will have a vim session with three split windows with three different files. But something might come up where I need to switch projects, close the vim session, and come back to it later.

Is there a way to have it where I can save the state of that vim session with 3 seperate files loaded, close it, and come back to it later? With out having to vsplit each file manually again.


Check out `:h Session'

You can save a session by :mksession session_name.vim and you can load a session by :source session_name.vim where session_name.vim is the name of the file that vim stores the info of a session.

If you use :mksession without a filename, it will by default be saved into a file called Session.vim in the current working directory.

You can configure what settings of the current session you want to be saved for later use by setting up :h 'sessionoptions'

  • Also check out Obsession by tpope on github—it makes some of the session stuff mindlessly easy.
    – D. Ben Knoble
    Apr 22 '19 at 23:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.