Skip to content

beguene/sessionman.vim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

This is a mirror of http://www.vim.org/scripts/script.php?script_id=2010

Vim provides a ':mksession' command to save the current editing session.  This plug-in helps to work with Vim sessions by keeping them in the dedicated location and by providing commands to list all sessions, open session, open last session, close session, save session and show last session.  From a list of sessions you can open session, delete session, edit session and edit extra session script.  Please note that session name can contain spaces and does not have to have a .vim extension.

On Windows, DOS and OS2 sessions are saved in:
  "$HOME/vimfiles/sessions"   if $HOME is defined
  "$APPDATA/Vim/sessions"     if $APPDATA is defined
  "$VIM/sessions"             otherwise
On Unix sessions are saved in:
  "$HOME/.vim/sessions"
If this directory does not exist, it will be created by the :SessionSave command (requires Vim 7).

At the top of the window there is a help that shows normal mode mappings:
  q                        - close session list
  o, <CR>, <2-LeftMouse>   - open session
  d                        - delete session
  e                        - edit session
  x                        - edit extra session script
The name of an opened session is saved in g:LAST_SESSION variable which is saved in the viminfo file if 'viminfo' option contains '!'.  It is used to open last session by :SessionOpenLast command.  It can be done when Vim starts (gvim +bd -c SessionOpenLast) or any time during a Vim session.  You can edit an extra session script to specify additional settings and actions associated with a given session.  If you change values of 'expandtab', 'tabstop' or 'shiftwidth', they will be restored to their original values when session is closed or before a new session is opened.  When session is opened and 'cscope' is enabled, script calls 'cscope add' for the current directory so make sure it is set correctly for the session.

:SessionOpen command takes a session name as an argument.  It supports argument completion.

:SessionOpenLast command opens the g:LAST_SESSION session (see above).

:SessionClose command wipes out all buffers, kills cscope and clears variables with session name.

:SessionSave command saves the current editing session.  If v:this_session is empty it asks for a session name.

:SessionSaveAs command takes a session name as an optional argument.  If there is no argument or it is empty, it asks for a session name (default is the last part of v:this_session).

:SessionShowLast command shows the content of the g:LAST_SESSION and v:this_session variables.

If 'sessionman_save_on_exit != 0' (default) then the current editing session will be automatically saved when you exit Vim.

Plug-in creates a "Sessions" sub-menu under the "File" menu.

Packages

No packages published

Languages

  • Vim Script 100.0%