sponsor Vim development Vim logo Vim Book Ad

session.vim : Extended session management for Vim

 script karma  Rating 172/68, Downloaded by 5855    Comments, bugs, improvements  Vim wiki

created by
Peter Odding
 
script type
utility
 
description
The session.vim plug-in improves upon Vim's built-in :mksession command by enabling you to easily and (if you want) automatically persist and restore your Vim editing sessions. It works by generating a Vim script that restores your current settings and the arrangement of tab pages and/or split windows and the files they contain. For more information about the plug-in please refer to its homepage or the project page on GitHub:

• http://peterodding.com/code/vim/session/
• http://github.com/xolox/vim-session

If you have questions, bug reports, suggestions, etc. the author can be contacted at peter@peterodding.com. If you like this plug-in please vote for it below!
 
install details
Please note that the vim-session plug-in requires my vim-misc plug-in which is separately distributed (see vimscript #4597).

Unzip the most recent ZIP archives of the vim-session and vim-misc plug-ins inside your Vim profile directory (usually this is ~/.vim on UNIX and %USERPROFILE%\vimfiles on Windows), restart Vim and execute the command :helptags ~/.vim/doc (use :helptags ~\vimfiles\doc instead on Windows). Now try it out: Open some tab pages and/or split windows, change your color scheme, etc. then save your session using the ":SaveSession my-first-session" command. You can now restore this session at any time by executing the ":OpenSession my-first-session" command.

If you prefer you can also use Pathogen, Vundle or a similar tool to install & update the vim-session and vim-misc plug-ins using a local clone of the git repository.
 

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
session.zip 2.7 2014-09-14 7.0 Peter Odding • Add support for lock directory configuration:
   http://github.com/xolox/vim-session/commit/4fb9cdd
session.zip 2.6.4 2014-07-30 7.0 Peter Odding • Drop the filtering of :args and :argu from the session file:
   http://github.com/xolox/vim-session/commit/40d08ab
session.zip 2.6.3 2014-07-30 7.0 Peter Odding • Write correct session lock when (auto-)opening tab-scoped session:
   http://github.com/xolox/vim-session/commit/8254cff
session.zip 2.6.2 2014-07-30 7.0 Peter Odding • Resolve issue #100 (bug fix for session_default_overwrite implementation):
   http://github.com/xolox/vim-session/commit/c247d0b
session.zip 2.6.1 2014-07-06 7.0 Peter Odding • Try to improve user feedback when sessions are locked:
   http://github.com/xolox/vim-session/commit/d833471
session.zip 2.6 2014-07-06 7.0 Peter Odding • Merge pull request #88: User defined session name completion suggestions:
   http://github.com/xolox/vim-session/commit/f13514a
session.zip 2.5 2014-07-06 7.0 Peter Odding • Explicitly credit Ingo for his work, also mention other contributions:
   http://github.com/xolox/vim-session/commit/d98a032

• Use xolox#misc#cursorhold#register() to setup periodic callback:
   http://github.com/xolox/vim-session/commit/cf412a9

• Merge pull request #78: Make color scheme persistence configurable:
   http://github.com/xolox/vim-session/commit/407ce08
session.zip 2.4.14 2014-06-18 7.0 Peter Odding • FIX: Correct order of tab and window restore commands:
   http://github.com/xolox/vim-session/commit/81dc04c

• Handle (i.e. do not increase) zero-width windows:
   http://github.com/xolox/vim-session/commit/c8f8417

• BUG: No prompt for session auto-load when unloaded buffers exist:
   http://github.com/xolox/vim-session/commit/e497a6d

• Merge pull request #93: Correct order of tab and window restore commands:
   http://github.com/xolox/vim-session/commit/70cbfa9

• Merge pull request #94: Handle (i.e. do not increase) zero-width windows:
   http://github.com/xolox/vim-session/commit/5338653

• Merge pull request #95: No prompt for session auto-load when unloaded buffers exist:
   http://github.com/xolox/vim-session/commit/da040dd
session.zip 2.4.11 2014-06-17 7.0 Peter Odding • Remove the -count=94919 workaround for :AppendTabSession.:
   http://github.com/xolox/vim-session/commit/de89506

• Don't leave behind empty tab page when :AppendTabSession is unsuccessful:
   http://github.com/xolox/vim-session/commit/f7845fa

• Merge pull request #82: Remove -count=94919 workaround for :AppendTabSession:
   http://github.com/xolox/vim-session/commit/1f576c1

• Merge pull request #83: Don't leave behind empty tab page when :AppendTabSession is unsuccessful:
   http://github.com/xolox/vim-session/commit/8e124c9
session.zip 2.4.9 2013-10-15 7.0 Peter Odding • Make :ViewSession compatible with console Vim (reported by Yuki Iwanaga):
   http://github.com/xolox/vim-session/commit/a55318b
session.zip 2.4.8 2013-07-20 7.0 Peter Odding • Allow to turn off the default Session menu via g:session_menu option (contributed by Ingo Karkat):
   http://github.com/xolox/vim-session/commit/58ae953
   http://github.com/xolox/vim-session/commit/9607a6b
session.zip 2.4.7 2013-07-04 7.0 Peter Odding • Support for sessions with multiple TagList windows:
   http://github.com/xolox/vim-session/commit/1f9bb68
session.zip 2.4.6 2013-07-03 7.0 Peter Odding • Add session_default_overwrite option (see readme for details):
   http://github.com/xolox/vim-session/commit/7186722
session.zip 2.4.5 2013-07-03 7.0 Peter Odding • Make sure vim-misc is installed, politely complain if it isn't:
   http://github.com/xolox/vim-session/commit/70c89aa
session.zip 2.4.4 2013-06-24 7.0 Peter Odding • Internal refactoring: Merge s:get_name() and xolox#session#find_current_session():
   http://github.com/xolox/vim-session/commit/f454460

• Internal refactoring: Replace s:select_name() with xolox#session#prompt_for_name():
   http://github.com/xolox/vim-session/commit/11c9534

• Working on inline function documentation:
   http://github.com/xolox/vim-session/commit/c06bcb1
   http://github.com/xolox/vim-session/commit/74e5034

• Bug fix: Re-implement Vim's special handling of initial, empty buffer:
   http://github.com/xolox/vim-session/commit/d5c3b6a
session.zip 2.4.1 2013-06-22 7.0 Peter Odding • Bug fix: Disable Vim's special handling of initial, empty buffer:
   http://github.com/xolox/vim-session/commit/aadb3a2
session.zip 2.4 2013-06-22 7.0 Peter Odding • Make :RestartVim retain server name (contributed by Steve Vermeulen):
   http://github.com/xolox/vim-session/commit/098f32b
   http://github.com/xolox/vim-session/commit/dd7f738
   http://github.com/xolox/vim-session/commit/bbd1f8f
session.zip 2.3.11 2013-06-06 7.0 Peter Odding • Bug fix: Don't persist &go and &gfn when !has('gui'):
   http://github.com/xolox/vim-session/commit/4664cc7
session.zip 2.3.10 2013-06-01 7.0 Peter Odding • BUG: Wrong "global session" label when saving tab session for the first time (contributed by Ingo Karkat):
   http://github.com/xolox/vim-session/commit/dd8931a
session.zip 2.3.9 2013-05-25 7.0 Peter Odding • Don't ask to forget when not recalling last session:
   http://github.com/xolox/vim-session/commit/cfc5bdf
session.zip 2.3.8 2013-05-25 7.0 Peter Odding • Allow to forget a saved default session, too (contribute by Ingo Karkat):
   http://github.com/xolox/vim-session/commit/95d3b41
session.zip 2.3.7 2013-05-25 7.0 Peter Odding • Persist Vim's verbosity (makes it easier to debug :RestartVim :-):
   http://github.com/xolox/vim-session/commit/62410ba

• Improve integration between vim-shell & vim-session:
   http://github.com/xolox/vim-session/commit/b2cdcaf
session.zip 2.3.5 2013-05-25 7.0 Peter Odding • Document vim-misc as external dependency (needs to be installed separately from now on):
   http://github.com/xolox/vim-session/commit/f97fc05

• Bug fix for :RestartVim on Windows (fixed quoting):
   http://github.com/xolox/vim-session/commit/b69e9ae
session.zip 2.3.4 2013-05-23 7.0 Peter Odding • Determine tab / global scope from sourced session, not the config (contributed by Ingo Karkat):
   http://github.com/xolox/vim-session/commit/982be75
   http://github.com/xolox/vim-session/commit/359575c
session.zip 2.3.2 2013-05-20 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-session/commit/5ad0d15
session.zip 2.3.1 2013-05-19 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-session/commit/f1cb34e
session.zip 2.3 2013-05-13 7.0 Peter Odding • Bug fix for automatic, periodic session saving:
   http://github.com/xolox/vim-session/commit/45c1525

• Updated miscellaneous scripts:
   http://github.com/xolox/vim-session/commit/05c4188
   http://github.com/xolox/vim-session/commit/9c88b0e
session.zip 2.2 2013-05-12 7.0 Peter Odding • Support for Conque Shell (suggested by Colin Wood):
   http://github.com/xolox/vim-session/commit/4552274
session.zip 2.1 2013-05-12 7.0 Peter Odding • Define menu items for commands defined by plug-in (suggested by Sergiy Borodych):
   http://github.com/xolox/vim-session/commit/ad6feb7
session.zip 2.0 2013-05-06 7.0 Peter Odding • Support for tab scoped sessions (large contributions by Ingo Karkat):
   http://github.com/xolox/vim-session/commit/702d22c
session.zip 1.8 2013-05-05 7.0 Peter Odding • Option to automatically save sessions every few minutes:
   http://github.com/xolox/vim-session/commit/96e547e
session.zip 1.7.3 2013-05-04 7.0 Peter Odding • Bug fix: Make auto-load work when 'viminfo' contains '%' (reported by Diego Mesa)
   http://github.com/xolox/vim-session/commit/166f1f7
session.zip 1.7.2 2013-05-03 7.0 Peter Odding • Make it easier to save a session for the 1st time (issues #19, #25):
   http://github.com/xolox/vim-session/commit/8cc18f0
session.zip 1.7.1 2013-05-03 7.0 Peter Odding • Bug fix: E121: Undefined variable: a:var (reported by Ivan Kuznetsov):
   http://github.com/xolox/vim-session/commit/7d2a45c
session.zip 1.7 2013-05-02 7.0 Peter Odding • Enable non-verbose interactive prompts (suggested by Ingo Karkat):
   http://github.com/xolox/vim-session/commit/c9fa3e2

• Make it possible to forget the last used session (suggested by Ingo Karkat):
   http://github.com/xolox/vim-session/commit/037d0ba
session.zip 1.6.3 2013-05-02 7.0 Peter Odding • Make :RestartVim work on Mac OS X:
   http://github.com/xolox/vim-session/commit/165ece4
session.zip 1.6.2 2013-05-01 7.0 Peter Odding • Option to set session filename extension:
   http://github.com/xolox/vim-session/commit/b892cca
session.zip 1.6.1 2013-05-01 7.0 Peter Odding • Option to set default session name (issue #22):
   http://github.com/xolox/vim-session/commit/6a4af75
session.zip 1.6 2013-05-01 7.0 Peter Odding • Bug fix: Release session lock before launching new instance (:RestartVim):
   http://github.com/xolox/vim-session/commit/64f3cac

• Expand environment variables in command arguments (issue #20):
   http://github.com/xolox/vim-session/commit/d0a3940
session.zip 1.5.11 2013-04-28 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-session/commit/66e75f6
session.zip 1.5.10 2013-04-21 7.0 Peter Odding • Handle :normal! fold restore in session file (contributed by Ingo Karkat):
   http://github.com/xolox/vim-session/commit/597de09
session.zip 1.5.9 2013-04-21 7.0 Peter Odding • Invoke autoload functions instead of custom commands (contributed by Ingo Karkat):
   http://github.com/xolox/vim-session/commit/b6b6d7f
session.zip 1.5.8 2013-04-21 7.0 Peter Odding • Avoid mandatory persistence of Vim size.:
   http://github.com/xolox/vim-session/commit/1707199

• Skip "save changes?" prompt when reopening sessions:
   http://github.com/xolox/vim-session/commit/2f22b53

• Merge pull request #32:
   http://github.com/xolox/vim-session/commit/e24a284

• Make compatibility with miscellaneous scripts explicit:
   http://github.com/xolox/vim-session/commit/d405393
session.zip 1.5.5 2013-04-20 7.0 Peter Odding • Remove dirty session tracking; it's too fragile (contributed by Matthew Torok):
   http://github.com/xolox/vim-session/commit/5d79e44

• Bug fix: Don't fire SessionLoadPost event until session is fully loaded  (contributed by Matthew Torok):
   http://github.com/xolox/vim-session/commit/db3f793

• Bug fix: On session restore, maintain cwd after loading NERDTree (contributed by Matthew Torok)
   http://github.com/xolox/vim-session/commit/d9ecc6a
session.zip 1.5.2 2013-04-18 7.0 Peter Odding • Bug fix: Disable :argglobal/:argument commands just like :args:
   http://github.com/xolox/vim-session/commit/e365e75
session.zip 1.5.1 2013-04-17 7.0 Peter Odding • Bug fix: Strip :args from :mksession output:
   http://github.com/xolox/vim-session/commit/66cbbb4
session.zip 1.5 2012-01-15 7.0 Peter Odding • Support for BufExplorer windows:
   http://github.com/xolox/vim-session/commit/ca2e72f
session.zip 1.4.25 2011-12-11 7.0 Peter Odding • New g:session_command_aliases option (issue #11):
   http://github.com/xolox/vim-session/commit/5d26cab
session.zip 1.4.24 2011-11-26 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-session/commit/1a9e32a
   http://github.com/xolox/vim-session/commit/11d7575
   http://github.com/xolox/vim-session/commit/9b4c774
session.zip 1.4.23 2011-11-21 7.0 Peter Odding • Work around &shellslash setting on Windows:
   http://github.com/xolox/vim-session/commit/02babeb
session.zip 1.4.22 2011-11-15 7.0 Peter Odding • Documentation bug fix for previous commit:
   http://github.com/xolox/vim-session/commit/6b0595a
session.zip 1.4.21 2011-11-11 7.0 Peter Odding • New 'session_persist_globals' option (requested by Roman Byshko):
   http://github.com/xolox/vim-session/commit/ff71e04
session.zip 1.4.20 2011-10-01 7.0 Peter Odding • Mark session dirty when buffer list changes:
   http://github.com/xolox/vim-session/commit/1ed64d2

• Make :RestartVim preserve $VIM and $VIMRUNTIME:
   http://github.com/xolox/vim-session/commit/f56fe44
session.zip 1.4.18 2011-09-25 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-session/commit/f9888a1
session.zip 1.4.17 2011-09-20 7.0 Peter Odding • Silence "E95: Buffer with this name already exist" messages:
   http://github.com/xolox/vim-session/commit/f061ad9
session.zip 1.4.16 2011-09-18 7.0 Peter Odding • Improve support for special windows, specifically NERDTree:
   http://github.com/xolox/vim-session/commit/5a4db7c

• Separate persistence of &background vs. :colorscheme:
   http://github.com/xolox/vim-session/commit/363c40d
session.zip 1.4.14 2011-09-17 7.0 Peter Odding • Support for mirrored NERDTree windows (requested by Sebastian Tramp):
   http://github.com/xolox/vim-session/commit/fe58d29
session.zip 1.4.13 2011-09-17 7.0 Peter Odding • Switch order of :colorscheme, :set background= commands:
   http://github.com/xolox/vim-session/commit/a3ba9f6
session.zip 1.4.12 2011-09-04 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-session/commit/cbb9a3b
session.zip 1.4.11 2011-08-31 7.0 Peter Odding • Version bump because of miscellaneous scripts:
   http://github.com/xolox/vim-session/commit/4c09a02
   http://github.com/xolox/vim-session/commit/96e63ff
session.zip 1.4.10 2011-08-31 7.0 Peter Odding • Move version variable to autoload script:
   http://github.com/xolox/vim-session/commit/93d504a

• Updated miscellaneous scripts (https://github.com/xolox/vim-misc):
   http://github.com/xolox/vim-session/commit/e374c77
session.zip 1.4.9 2011-06-18 7.0 Peter Odding • Define version as variable, include version in messages:
   http://github.com/xolox/vim-session/commit/435786b
session.zip 1.4.8 2011-06-13 7.0 Peter Odding • Bug fix: Don't hang during :RestartVim when &verbose >= 1:
   http://github.com/xolox/vim-session/commit/1f9c911
session.zip 1.4.7 2011-06-12 7.0 Peter Odding • Ignore "No fold found" errors:
   http://github.com/xolox/vim-session/commit/13d405d
session.zip 1.4.6 2011-06-03 7.0 Peter Odding • Ignore missing fonts (reported by SteP):
   http://github.com/xolox/vim-session/commit/d9af5b1
session.zip 1.4.5 2011-06-01 7.0 Peter Odding • Make it possible to disable automatic loading/saving (suggested by Tommi Kivelไ):
   http://github.com/xolox/vim-session/commit/28a1eaf
session.zip 1.4.4 2011-05-26 7.0 Peter Odding • Restore NERDTree buffer after :CloseSession (thanks to Brandon Martin for bug report / feature request :-):
   http://github.com/xolox/vim-session/commit/e6a4ff2
session.zip 1.4.3 2011-05-26 7.0 Peter Odding • Enable opening last used session when starting Vim (thanks to James Cox for suggestion):
   http://github.com/xolox/vim-session/commit/6855a81

• Remember the 'background' setting:
   http://github.com/xolox/vim-session/commit/3635adb
session.zip 1.4 2011-05-12 7.0 Peter Odding • Make :OpenSession and :CloseSession preserve working directory:
   https://github.com/xolox/vim-session/commit/ae7ba3a9e99db2f52c7a

• Make :CloseSession close buffers (or they'll keep piling up):
   https://github.com/xolox/vim-session/commit/cab03c308b5dabaa6cd8

Thanks to Brandon Martin for reporting both issues!
session.zip 1.3.8 2010-12-25 7.0 Peter Odding • The plug-in will now try to restore quick-fix windows:
   https://github.com/xolox/vim-session/commit/46962c2c87236ea02b67

• I've instrumented the :OpenSession / :SaveSession commands so that they'll print their execution time when &verbose >= 1:
   https://github.com/xolox/vim-session/commit/dba3f0c493fb10b19d6f

• Support for special windows has been simplified:
   https://github.com/xolox/vim-session/commit/196fda1ad95c5a350510
session.zip 1.3.5 2010-12-20 7.0 Peter Odding • Restore compatibility with netrw buffers:
   https://github.com/xolox/vim-session/commit/54f2f388962ad7c288f2

• Persist window size for plug-in windows:
   https://github.com/xolox/vim-session/commit/8bf201e5c73a33ff1626

• Remove duplicate code and fnameescape() bug
   https://github.com/xolox/vim-session/commit/309dc4b2f90586fa54fc
session.zip 1.3.2 2010-12-20 7.0 Peter Odding • Use real script name in messages:
   https://github.com/xolox/vim-session/commit/9628d48de4220056aad1

• Improved & documented the :RestartVim command:
   https://github.com/xolox/vim-session/commit/86807060e97c4487082f
session.zip 1.3 2010-08-30 7.0 Peter Odding • Bug fix? Unlock deleted sessions:
   http://github.com/xolox/vim-session/commit/ca5fe566022303034526c791543cffb218f5faa7

• :ViewSession to quickly view generated Vim scripts:
   http://github.com/xolox/vim-session/commit/5cbb45ae5855ab6406a2013c4fabdae5abfb3d51

• Improve command argument handling, avoid double unescaping:
   http://github.com/xolox/vim-session/commit/8cc669975b8d8026b1649c899cd3fc37513a8478

• Make Vim on GTK restore &lines and &columns:
   http://github.com/xolox/vim-session/commit/6fa62c702173682ca3825e2bcb2fe4d7ffbede7d

• Silence :RestartVim, ignore lock files:
   http://github.com/xolox/vim-session/commit/b0631c7a0edbe4b2493637783a9c84225ba05a9e

• Use :mksession instead of reimplementing it, support 'sessionoptions', restore ':Project' windows:
   http://github.com/xolox/vim-session/commit/a0475914cff7af83e58325391e933ce77cd23161
session.zip 1.2.3 2010-08-19 7.0 Peter Odding • Improve compatibility with :mksession by setting g:SessionLoad:
   http://github.com/xolox/vim-session/commit/fe61f0170e1a54dd6a87ac3031228370de3c5497

• Vim 7.0 compatibility, :Restart improvement:
   http://github.com/xolox/vim-session/commit/c02815d6505d520ebf76471c0605a2d120f69899
session.zip 1.2.2 2010-07-30 7.0 Peter Odding • Enable user defined SwapExists autocmd using <nested> keyword:
   http://github.com/xolox/vim-session/commit/0341c020336174460455719be50049caaceea3d2

• Experimental :RestartVim command (to be documented):
   http://github.com/xolox/vim-session/commit/ec2ead371fb6e77a31c6b8dcbc151f290d3b07fc

• Experimental support for buffer list persistence:
   http://github.com/xolox/vim-session/commit/6ad9516c3aba9b7cfa04c9233d4bb7ff3e2e48f8
session.zip 1.2.1 2010-07-16 7.0 Peter Odding • Plug-in doesn't prompt on --servername anymore, that was before lock files:
   http://github.com/xolox/vim-session/commit/765e9312dbb7909783cd3f096ad42aae3859b412

• The default session isn't automatically deleted anymore, that was an ugly hack before lock files were used!
• Finished description of g:session_autosave option :-s
• Documented the :DeleteSession command.
• Documented session locking and the bang workaround.
• The :SaveSession command now locks the session after saving.
   http://github.com/xolox/vim-session/commit/50ad3662d58bc574a93f5c327f8fab5d0f9c4f5f
session.zip 1.2 2010-07-16 7.0 Peter Odding • Added uniform confirmational messages to :commands:
   http://github.com/xolox/vim-session/commit/7b31f5ba0c4c3d44afaddf39eed3aa739ae23a63

• Basic support for restoring NERD tree:
   http://github.com/xolox/vim-session/commit/7513e54b91477755ff5e615e054b0e2e7f5802e9
session.zip 1.1.1 2010-07-15 7.0 Peter Odding Improved documentation, added automatic update support using GLVS plug-in:
http://github.com/xolox/vim-session/commit/b228b5ad7cff4fcab76a432b340b82f6336a4e6d
session.zip 1.1 2010-07-15 7.0 Peter Odding Initial upload
ip used for rating: 54.81.109.37

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo