Skip to content

Commit 70c89aa

Browse files
committed
Make sure vim-misc is installed, politely complain if it isn't
See issue #65 on GitHub and numerous other issues before it: #65
1 parent d5c3b6a commit 70c89aa

File tree

4 files changed

+33
-9
lines changed

4 files changed

+33
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ Recently this plug-in switched from reimplementing [:mksession][mksession] to ac
236236
<!-- Start of generated documentation -->
237237

238238
The documentation of the 34 functions below was extracted from
239-
1 Vim scripts on June 24, 2013 at 23:47.
239+
1 Vim scripts on July 4, 2013 at 00:27.
240240

241241
### Public API for the vim-notes plug-in
242242

autoload/xolox/session.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
" Public API for the vim-notes plug-in.
22
"
33
" Author: Peter Odding
4-
" Last Change: June 24, 2013
4+
" Last Change: July 4, 2013
55
" URL: http://peterodding.com/code/vim/session/
66

7-
let g:xolox#session#version = '2.4.4'
7+
let g:xolox#session#version = '2.4.5'
88

99
" Public API for session persistence. {{{1
1010

doc/session.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ might take a while...)
477477
Function reference ~
478478

479479
The documentation of the 34 functions below was extracted from 1 Vim scripts on
480-
June 24, 2013 at 23:47.
480+
July 4, 2013 at 00:27.
481481

482482
-------------------------------------------------------------------------------
483483
*session-public-api-for-vim-notes-plug-in*

plugin/session.vim

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Vim script
22
" Author: Peter Odding
3-
" Last Change: May 12, 2013
3+
" Last Change: July 4, 2013
44
" URL: http://peterodding.com/code/vim/session/
55

66
" Support for automatic update using the GLVS plug-in.
@@ -11,6 +11,22 @@ if &cp || exists('g:loaded_session')
1111
finish
1212
endif
1313

14+
" Make sure vim-misc is installed. {{{1
15+
16+
try
17+
" The point of this code is to do something completely innocent while making
18+
" sure the vim-misc plug-in is installed. We specifically don't use Vim's
19+
" exists() function because it doesn't load auto-load scripts that haven't
20+
" already been loaded yet (last tested on Vim 7.3).
21+
call type(g:xolox#misc#version)
22+
catch
23+
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."
24+
let g:loaded_session = 1
25+
finish
26+
endtry
27+
28+
" Configuration defaults. {{{1
29+
1430
" The name of the default session (without directory or filename extension).
1531
if !exists('g:session_default_name')
1632
let g:session_default_name = 'default'
@@ -82,7 +98,8 @@ if !exists('g:session_command_aliases')
8298
let g:session_command_aliases = 0
8399
endif
84100

85-
" Make sure the session scripts directory exists and is writable.
101+
" Make sure the sessions directory exists and is writable. {{{1
102+
86103
let s:directory = fnamemodify(g:session_directory, ':p')
87104
if !isdirectory(s:directory)
88105
call mkdir(s:directory, 'p')
@@ -95,7 +112,8 @@ if filewritable(s:directory) != 2
95112
endif
96113
unlet s:directory
97114

98-
" Define menu items to make the plug-in more accessible.
115+
" Menu items to make the plug-in more accessible. {{{1
116+
99117
amenu 400.10 &Sessions.&Open\ session\.\.\.<Tab>:OpenSession :OpenSession<CR>
100118
amenu 400.20 &Sessions.&Save\ session\.\.\.<Tab>:SaveSession :SaveSession<CR>
101119
amenu 400.30 &Sessions.&Close\ session\.\.\.<Tab>:CloseSession :CloseSession<CR>
@@ -109,7 +127,8 @@ amenu 400.100 &Sessions.Close\ tab\ session\.\.\.<Tab>:CloseTabSession :CloseTab
109127
amenu 400.110 &Sessions.-Sep2- :
110128
amenu 400.120 &Sessions.&Restart\ Vim\.\.\.<Tab>:RestartVim :RestartVim<CR>
111129

112-
" Define automatic commands for automatic session management.
130+
" Automatic commands for automatic session management. {{{1
131+
113132
augroup PluginSession
114133
autocmd!
115134
au VimEnter * nested call xolox#session#auto_load()
@@ -118,6 +137,8 @@ augroup PluginSession
118137
au VimLeavePre * call xolox#session#auto_unlock()
119138
augroup END
120139

140+
" Plug-in commands (user defined commands). {{{1
141+
121142
" Define commands that enable users to manage multiple named, heavy-weight
122143
" sessions (used to persist/restore a complete Vim editing session including
123144
" one or more tab pages).
@@ -137,6 +158,8 @@ command! -bar -bang CloseTabSession call xolox#session#close_tab_cmd(<q-bang>, '
137158
" Define a command to restart Vim editing sessions.
138159
command! -bang -nargs=* -complete=command RestartVim call xolox#session#restart_cmd(<q-bang>, <q-args>)
139160

161+
" Plug-in command aliases. {{{2
162+
140163
if g:session_command_aliases
141164
" Define command aliases of the form "Session" + Action in addition to
142165
" the real command names which are of the form Action + "Session" (above).
@@ -151,7 +174,8 @@ if g:session_command_aliases
151174
command! -bar -bang SessionTabClose call xolox#session#close_tab_cmd(<q-bang>, 'SessionTabClose')
152175
endif
153176

154-
" Don't reload the plug-in once it has loaded successfully.
177+
" Don't reload the plug-in once it has loaded successfully. {{{1
178+
155179
let g:loaded_session = 1
156180

157181
" vim: ts=2 sw=2 et

0 commit comments

Comments
 (0)