Permalink
Browse files

Make it possible to disable use of Lua Interface for Vim

Relevant for issue #20:
  #20
  • Loading branch information...
1 parent aa7a642 commit 5d0ec87ad5dfa0d55ea3b69bf8abe33ce90ea0f2 @xolox committed Jun 17, 2014
Showing with 30 additions and 15 deletions.
  1. +5 −0 README.md
  2. +3 −3 autoload/xolox/lua.vim
  3. +22 −12 doc/ft_lua.txt
View
@@ -66,6 +66,10 @@ You can manually check the globals using the `:CheckGlobals` command.
The name or path of the Lua interpreter used to evaluate Lua scripts used by the plug-in (for example the script that checks for undefined global variables, see `:LuaCheckGlobals`).
+### The `lua_internal` option
+
+If you're running a version of Vim that supports the Lua Interface for Vim (see [if_lua.txt][if_lua.txt]) then all Lua code evaluated by the Lua file type plug-in is evaluated using the Lua Interface for Vim. If the Lua Interface for Vim is not available the plug-in falls back to using an external Lua interpreter. You can set this to false (0) to force the plug-in to use an external Lua interpreter.
+
### The `lua_compiler_name` option
The name or path of the Lua compiler used to check for syntax errors (defaults to `luac`). You can set this option to run the Lua compiler from a non-standard location or to run a dedicated syntax checker like [lualint][ll].
@@ -165,6 +169,7 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M
[gf]: http://vimdoc.sourceforge.net/htmldoc/editing.html#gf
[github-lua-ftplugin]: http://github.com/xolox/vim-lua-ftplugin
[github-misc]: http://github.com/xolox/vim-misc
+[if_lua.txt]: http://vimdoc.sourceforge.net/htmldoc/if_lua.html#if_lua.txt
[inc]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27include%27
[inex]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27includeexpr%27
[ll]: http://lua-users.org/wiki/LuaLint
View
@@ -3,7 +3,7 @@
" Last Change: June 17, 2014
" URL: http://peterodding.com/code/vim/lua-ftplugin
-let g:xolox#lua#version = '0.7.20'
+let g:xolox#lua#version = '0.7.21'
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'
@@ -25,7 +25,7 @@ endfunction
function! xolox#lua#getsearchpath(envvar, luavar) " {{{1
let path = ''
- if has('lua')
+ if xolox#misc#option#get('lua_internal', has('lua'))
" Try to get the search path using the Lua Interface for Vim.
try
redir => path
@@ -478,7 +478,7 @@ function! xolox#lua#tweakoptions() " {{{1
endfunction
function! xolox#lua#dofile(pathname, arguments) " {{{1
- if has('lua')
+ if xolox#misc#option#get('lua_internal', has('lua'))
" Use the Lua Interface for Vim.
call xolox#misc#msg#debug("lua.vim %s: Running '%s' using Lua Interface for Vim ..", g:xolox#lua#version, a:pathname)
redir => output
View
@@ -10,18 +10,19 @@ Contents ~
2. The |lua_check_syntax| option
3. The |lua_check_globals| option
4. The |lua_interpreter_path| option
- 5. The |lua_compiler_name| option
- 6. The |lua_compiler_args| option
- 7. The |lua_error_format| option
- 8. The |lua_complete_keywords| option
- 9. The |lua_complete_globals| option
- 10. The |lua_complete_library| option
- 11. The |lua_complete_dynamic| option
- 12. The |lua_complete_omni| option
- 13. The |lua_omni_blacklist| option
- 14. The |lua_define_completefunc| option
- 15. The |lua_define_omnifunc| option
- 16. The |lua_define_completion_mappings| option
+ 5. The |lua_internal| option
+ 6. The |lua_compiler_name| option
+ 7. The |lua_compiler_args| option
+ 8. The |lua_error_format| option
+ 9. The |lua_complete_keywords| option
+ 10. The |lua_complete_globals| option
+ 11. The |lua_complete_library| option
+ 12. The |lua_complete_dynamic| option
+ 13. The |lua_complete_omni| option
+ 14. The |lua_omni_blacklist| option
+ 15. The |lua_define_completefunc| option
+ 16. The |lua_define_omnifunc| option
+ 17. The |lua_define_completion_mappings| option
4. Commands |ft_lua-commands|
1. The |:LuaCheckSyntax| command
2. The |:LuaCheckGlobals| command
@@ -150,6 +151,15 @@ The name or path of the Lua interpreter used to evaluate Lua scripts used by
the plug-in (for example the script that checks for undefined global variables,
see |:LuaCheckGlobals|).
+-------------------------------------------------------------------------------
+The *lua_internal* option
+
+If you're running a version of Vim that supports the Lua Interface for Vim (see
+|if_lua.txt|) then all Lua code evaluated by the Lua file type plug-in is
+evaluated using the Lua Interface for Vim. If the Lua Interface for Vim is not
+available the plug-in falls back to using an external Lua interpreter. You can
+set this to false (0) to force the plug-in to use an external Lua interpreter.
+
-------------------------------------------------------------------------------
The *lua_compiler_name* option

0 comments on commit 5d0ec87

Please sign in to comment.