Vim plugin for working with sessions
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Vim plugin for saving and loading sessions

Issue Count


  1. Save and load sessions by name.
  2. Tab autocompletion of session names when saving or loading sessions.
  3. Automatically save the "latest" version of a named session while keeping the original session intact.
  4. Delete sessions by name.
  5. Automatically save your session whenever you quit Vim using a session named "last".



Install vim-bg-sessions like you would any other Vim plugin.

For Pathogen:

cd ~/.vim/bundles
git clone




Lists all saved sessions.

:SaveSession [session_name]

Saves your current sessions. If session_name is provided, a session will be saved with that name. Otherwise, the session will be saved with the name of "last".

When saving a named session, the "last" session is also updated.

Use tab for session name autocompletion.

Example: Save a session named "myFirstSession"

:SaveSession myFirstSession

:LoadSession [session_name]

Loads a session. If session_name is provided, the session by that name will be loaded. Otherwise, the session named "last" will be loaded. Use tab for session name autocompletion.

Example: Load a session named "myFirstSession"

:LoadSession myFirstSession

Example: Load your last session from the last time you closed Vim



:LoadSession last

Example: Load the "latest" version of a session named "myFirstSession"

You've saved a session named "myProject" for a particular project, and you want to be able to always return to that session, so you don't re-save it after continuing your work (e.g. opening additional buffers/windows/tabs). But you also want to be able to return to your last state after you loaded that session, including all of the changes since the "myProject" session was loaded. This plugin will automatically save a session named "myProject_latest" any time you enter a new buffer.

:LoadSession myFirstSession_latest

:DeleteSession session_name

Deletes the session named session_name. Use tab for session name autocompletion.

Example: Delete a session named "myFirstSession"

:DeleteSession myFirstSession


Saved Session Directory

Session files are stored in the directory provided by the global variable g:bg_sessions_dir which is set to "~/.vim-sessions" by default.