sessionman.vim : Vim session manager



script karma Rating 375/130, Downloaded by 7578 Comments, bugs, improvements Vim wiki created by Yuri Klubakov script type utility description 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.

install details Download and copy sessionman.vim to $HOME/.vim/plugin (Unix) or $HOME/vimfiles/plugin (Windows) or $VIM/vimfiles/plugin (both) directory. rate this script Life Changing Helpful Unfulfilling script versions (upload new version) Click on the package to download. package script version date Vim version user release notes sessionman.vim 1.07 2015-04-09 6.0 Yuri Klubakov Wiping out all buffers with '%bwipeout' was reported to be more reliable by demon386 sessionman.vim 1.06 2011-05-06 6.0 Yuri Klubakov - Added more "doautoall" commands when session is opened (thanks to Marcin Szamotulski)

- Turned off spell checking in session list window. sessionman.vim 1.05 2011-05-06 6.0 Yuri Klubakov - Improved compatibility with other scripts.

- Kill all cscope connections before sourcing new session.

That allows to add additional connections in extra session script.

- Fixed extra session script file name when session name has an extension.

- Removed <ESC> mapping. Only 'q' will close session list.

sessionman.vim 1.04 2008-06-22 6.0 Yuri Klubakov - Added ability to edit session file (can be useful if you moved files to a different location) and extra session script (see description).

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

- Added test if session list window is already displayed and switch to it if it is.

- Show help at the top of the session list window instead of the status line (with Erik Falor) sessionman.vim 1.03 2007-09-13 6.0 Yuri Klubakov - The command names were changed to start with :Session... to make them completion-friendly (sorry for breaking your settings).

- Added :SessionOpen {session} command that supports argument completion. It makes it possible to open a session without showing session list (useful when used in a script).

- Added :SessionSaveAs [session] command. It makes it possible to save a session without a prompt when called with an argument (useful when used in a script).

- :SessionSave command now saves the active session without a prompt if v:this_session is not empty. sessionman.vim 1.02 2007-09-11 6.0 Yuri Klubakov Configurable option to automatically save the current editing session on exit (with Viktor Kojouharov) sessionman.vim 1.01 2007-09-08 6.0 Yuri Klubakov - "OS friendly" sessions location (see description)

- Create new window for the session list

- Create "Sessions" sub-menu under the "File" menu sessionman.vim 1.0 2007-09-05 6.0 Yuri Klubakov Initial upload ip used for rating: 176.9.113.70