Permalink
Browse files

Make sure vim-misc is installed, politely complain if it isn't

  • Loading branch information...
1 parent 5157b16 commit 73736ada4bd78338d243f38b242c588b1fe18957 @xolox committed Aug 19, 2013
Showing with 17 additions and 4 deletions.
  1. +2 −2 autoload/xolox/lua.vim
  2. +1 −1 doc/ft_lua.txt
  3. +14 −1 plugin/lua-ftplugin.vim
View
@@ -1,9 +1,9 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: June 22, 2013
+" Last Change: August 19, 2013
" URL: http://peterodding.com/code/vim/lua-ftplugin
-let g:xolox#lua#version = '0.7.11'
+let g:xolox#lua#version = '0.7.12'
let s:miscdir = expand('<sfile>:p:h:h:h') . '/misc/lua-ftplugin'
let s:omnicomplete_script = s:miscdir . '/omnicomplete.lua'
let s:globals_script = s:miscdir . '/globals.lua'
View
@@ -220,7 +220,7 @@ lua-ftplugin. If you like this plug-in please vote for it on Vim Online [17].
*ft_lua-license*
License ~
-This software is licensed under the MIT license [18]. © 2013 Peter Odding
+This software is licensed under the MIT license [18]. Š 2013 Peter Odding
<peter@peterodding.com>.
===============================================================================
View
@@ -1,7 +1,7 @@
" Vim file type plug-in
" Language: Lua 5.1
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: August 27, 2011
+" Last Change: August 19, 2013
" URL: http://peterodding.com/code/vim/lua-ftplugin
" Support for automatic update using the GLVS plug-in.
@@ -12,6 +12,19 @@ if &cp || exists('g:loaded_lua_ftplugin')
finish
endif
+" Make sure vim-misc is installed.
+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-lua-ftplugin 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-lua-ftplugin plug-in will now be disabled."
+ let g:loaded_lua_ftplugin = 1
+ finish
+endtry
+
" Commands to manually check for syntax errors and undefined globals.
command! -bar LuaCheckSyntax call xolox#lua#checksyntax()
command! -bar -bang LuaCheckGlobals call xolox#lua#checkglobals(<q-bang> == '!')

0 comments on commit 73736ad

Please sign in to comment.