1

Sometimes I have Vim running with a good number of tabs, buffers, etc, but I need to quit to reboot, install a new Vim version, etc.

But when I start Vim back up I want the same tabs, split windows, with the same files open in them.

Is there any way to do this? Does Vim have a concept of "sessions"?

(I'm not worried about tabs or buffers that contained contents not loaded from files.)

hippietrail
  • 15,848
  • 18
  • 99
  • 158

2 Answers2

2

Yeah of course VIM knows session managment :)

From the vim doc :

A Vim session contains all the information about what you are editing. This includes things such as the file list, window layout, global variables, options and other information. (Exactly what is remembered is controlled by the 'sessionoptions' option, described below.) The following command creates a session file:

:mksession vimbook.vim

Later if you want to restore this session, you can use this command:

:source vimbook.vim

Check out this tuto about this functionnality : http://usevim.com/2013/07/05/sessions/

Xavier
  • 3,919
  • 3
  • 27
  • 55
2

Make a session in Vim:

:mksession session.vim

In terminal, restore session:

$ vim -S session.vim

Or when already in Vim, restore session:

:source session.vim

Stefan van den Akker
  • 6,661
  • 7
  • 48
  • 63