diff --git a/autoload/xolox/lua.vim b/autoload/xolox/lua.vim index 1885a1f..4050663 100644 --- a/autoload/xolox/lua.vim +++ b/autoload/xolox/lua.vim @@ -1,13 +1,13 @@ " Vim auto-load script " Author: Peter Odding -" Last Change: June 18, 2011 +" Last Change: August 27, 2011 " URL: http://peterodding.com/code/vim/lua-ftplugin let s:miscdir = expand(':p:h:h:h') . '/misc/lua-ftplugin' let s:omnicomplete_script = s:miscdir . '/omnicomplete.lua' let s:globals_script = s:miscdir . '/globals.lua' -function! xolox#lua#getopt(name, default) " {{{1 +function! xolox#misc#option#get(name, default) " {{{1 if exists('g:' . a:name) return eval('g:' . a:name) elseif exists('b:' . a:name) @@ -63,19 +63,19 @@ endfunction function! xolox#lua#autocheck() " {{{1 if &filetype == 'lua' - if xolox#lua#getopt('lua_check_syntax', 1) + if xolox#misc#option#get('lua_check_syntax', 1) call xolox#lua#checksyntax() endif - if xolox#lua#getopt('lua_check_globals', 0) && empty(getqflist()) + if xolox#misc#option#get('lua_check_globals', 0) && empty(getqflist()) call xolox#lua#checkglobals(0) endif endif endfunction function! xolox#lua#checksyntax() " {{{1 - let compiler_name = xolox#lua#getopt('lua_compiler_name', 'luac') - let compiler_args = xolox#lua#getopt('lua_compiler_args', '-p') - let error_format = xolox#lua#getopt('lua_error_format', 'luac: %f:%l: %m') + let compiler_name = xolox#misc#option#get('lua_compiler_name', 'luac') + let compiler_args = xolox#misc#option#get('lua_compiler_args', '-p') + let error_format = xolox#misc#option#get('lua_error_format', 'luac: %f:%l: %m') if !executable(compiler_name) let message = "lua.vim %s: The configured Lua compiler" let message .= " doesn't seem to be available! I'm disabling" @@ -291,13 +291,13 @@ function! xolox#lua#completefunc(init, base) " {{{1 return s:getcompletionprefix() endif let items = [] - if xolox#lua#getopt('lua_complete_keywords', 1) + if xolox#misc#option#get('lua_complete_keywords', 1) call extend(items, g:xolox#lua_data#keywords) endif - if xolox#lua#getopt('lua_complete_globals', 1) + if xolox#misc#option#get('lua_complete_globals', 1) call extend(items, g:xolox#lua_data#globals) endif - if xolox#lua#getopt('lua_complete_library', 1) + if xolox#misc#option#get('lua_complete_library', 1) call extend(items, g:xolox#lua_data#library) endif let pattern = '^' . xolox#misc#escape#pattern(a:base) @@ -334,7 +334,7 @@ endfunction function! xolox#lua#omnifunc(init, base) " {{{1 if a:init return s:getcompletionprefix() - elseif !xolox#lua#getopt('lua_complete_omni', 0) + elseif !xolox#misc#option#get('lua_complete_omni', 0) throw printf("lua.vim %s: omni completion needs to be explicitly enabled, see the readme!", g:lua_ftplugin_version) endif if !exists('s:omnifunc_modules') @@ -419,8 +419,8 @@ function! xolox#lua#getomnivariables(modules) " {{{1 endfunction function! xolox#lua#completedynamic(type) " {{{1 - if xolox#lua#getopt('lua_complete_dynamic', 1) - if (a:type == "'" || a:type == '"') && xolox#lua#getopt('lua_complete_omni', 0) + if xolox#misc#option#get('lua_complete_dynamic', 1) + if (a:type == "'" || a:type == '"') && xolox#misc#option#get('lua_complete_omni', 0) if strpart(getline('.'), 0, col('.') - 1) =~ 'require[^''"]*$' return a:type . "\\" endif @@ -432,7 +432,7 @@ function! xolox#lua#completedynamic(type) " {{{1 " are available, which is kind of annoying. But I don't know of an " alternative to :silent that can be used inside of " mappings?! - if xolox#lua#getopt('lua_complete_omni', 0) + if xolox#misc#option#get('lua_complete_omni', 0) return a:type . "\\" else return a:type . "\\" diff --git a/plugin/lua-ftplugin.vim b/plugin/lua-ftplugin.vim index 4b045f6..4c9435e 100644 --- a/plugin/lua-ftplugin.vim +++ b/plugin/lua-ftplugin.vim @@ -12,7 +12,7 @@ if &cp || exists('g:loaded_lua_ftplugin') finish endif -let g:lua_ftplugin_version = '0.6.18' +let g:lua_ftplugin_version = '0.6.19' " Commands to manually check for syntax errors and undefined globals. command! -bar LuaCheckSyntax call xolox#lua#checksyntax()