diff --git a/README.md b/README.md index cfc6049..47649fb 100644 --- a/README.md +++ b/README.md @@ -236,7 +236,7 @@ Recently this plug-in switched from reimplementing [:mksession][mksession] to ac The documentation of the 34 functions below was extracted from -1 Vim scripts on June 24, 2013 at 23:47. +1 Vim scripts on July 4, 2013 at 00:27. ### Public API for the vim-notes plug-in diff --git a/autoload/xolox/session.vim b/autoload/xolox/session.vim index 83e429b..d96c465 100644 --- a/autoload/xolox/session.vim +++ b/autoload/xolox/session.vim @@ -1,10 +1,10 @@ " Public API for the vim-notes plug-in. " " Author: Peter Odding -" Last Change: June 24, 2013 +" Last Change: July 4, 2013 " URL: http://peterodding.com/code/vim/session/ -let g:xolox#session#version = '2.4.4' +let g:xolox#session#version = '2.4.5' " Public API for session persistence. {{{1 diff --git a/doc/session.txt b/doc/session.txt index 5752f92..0a089c3 100644 --- a/doc/session.txt +++ b/doc/session.txt @@ -477,7 +477,7 @@ might take a while...) Function reference ~ The documentation of the 34 functions below was extracted from 1 Vim scripts on -June 24, 2013 at 23:47. +July 4, 2013 at 00:27. ------------------------------------------------------------------------------- *session-public-api-for-vim-notes-plug-in* diff --git a/plugin/session.vim b/plugin/session.vim index 3ed2e37..3a37cc7 100644 --- a/plugin/session.vim +++ b/plugin/session.vim @@ -1,6 +1,6 @@ " Vim script " Author: Peter Odding -" Last Change: May 12, 2013 +" Last Change: July 4, 2013 " URL: http://peterodding.com/code/vim/session/ " Support for automatic update using the GLVS plug-in. @@ -11,6 +11,22 @@ if &cp || exists('g:loaded_session') finish endif +" Make sure vim-misc is installed. {{{1 + +try + " The point of this code is to do something completely innocent while making + " sure the vim-misc plug-in is installed. We specifically don't use Vim's + " exists() function because it doesn't load auto-load scripts that haven't + " already been loaded yet (last tested on Vim 7.3). + call type(g:xolox#misc#version) +catch + echomsg "Warning: The vim-session plug-in requires the vim-misc plug-in which seems not to be installed! For more information please review the installation instructions in the readme (also available on the homepage and on GitHub). The vim-session plug-in will now be disabled." + let g:loaded_session = 1 + finish +endtry + +" Configuration defaults. {{{1 + " The name of the default session (without directory or filename extension). if !exists('g:session_default_name') let g:session_default_name = 'default' @@ -82,7 +98,8 @@ if !exists('g:session_command_aliases') let g:session_command_aliases = 0 endif -" Make sure the session scripts directory exists and is writable. +" Make sure the sessions directory exists and is writable. {{{1 + let s:directory = fnamemodify(g:session_directory, ':p') if !isdirectory(s:directory) call mkdir(s:directory, 'p') @@ -95,7 +112,8 @@ if filewritable(s:directory) != 2 endif unlet s:directory -" Define menu items to make the plug-in more accessible. +" Menu items to make the plug-in more accessible. {{{1 + amenu 400.10 &Sessions.&Open\ session\.\.\.:OpenSession :OpenSession amenu 400.20 &Sessions.&Save\ session\.\.\.:SaveSession :SaveSession amenu 400.30 &Sessions.&Close\ session\.\.\.:CloseSession :CloseSession @@ -109,7 +127,8 @@ amenu 400.100 &Sessions.Close\ tab\ session\.\.\.:CloseTabSession :CloseTab amenu 400.110 &Sessions.-Sep2- : amenu 400.120 &Sessions.&Restart\ Vim\.\.\.:RestartVim :RestartVim -" Define automatic commands for automatic session management. +" Automatic commands for automatic session management. {{{1 + augroup PluginSession autocmd! au VimEnter * nested call xolox#session#auto_load() @@ -118,6 +137,8 @@ augroup PluginSession au VimLeavePre * call xolox#session#auto_unlock() augroup END +" Plug-in commands (user defined commands). {{{1 + " Define commands that enable users to manage multiple named, heavy-weight " sessions (used to persist/restore a complete Vim editing session including " one or more tab pages). @@ -137,6 +158,8 @@ command! -bar -bang CloseTabSession call xolox#session#close_tab_cmd(, ' " Define a command to restart Vim editing sessions. command! -bang -nargs=* -complete=command RestartVim call xolox#session#restart_cmd(, ) +" Plug-in command aliases. {{{2 + if g:session_command_aliases " Define command aliases of the form "Session" + Action in addition to " the real command names which are of the form Action + "Session" (above). @@ -151,7 +174,8 @@ if g:session_command_aliases command! -bar -bang SessionTabClose call xolox#session#close_tab_cmd(, 'SessionTabClose') endif -" Don't reload the plug-in once it has loaded successfully. +" Don't reload the plug-in once it has loaded successfully. {{{1 + let g:loaded_session = 1 " vim: ts=2 sw=2 et