Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make it possible to disable use of Lua Interface for Vim
Relevant for issue #20:
  #20
  • Loading branch information
xolox committed Jun 17, 2014
1 parent aa7a642 commit 5d0ec87
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -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 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 `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]. 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].
Expand Down Expand Up @@ -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 [gf]: http://vimdoc.sourceforge.net/htmldoc/editing.html#gf
[github-lua-ftplugin]: http://github.com/xolox/vim-lua-ftplugin [github-lua-ftplugin]: http://github.com/xolox/vim-lua-ftplugin
[github-misc]: http://github.com/xolox/vim-misc [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 [inc]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27include%27
[inex]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27includeexpr%27 [inex]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27includeexpr%27
[ll]: http://lua-users.org/wiki/LuaLint [ll]: http://lua-users.org/wiki/LuaLint
Expand Down
6 changes: 3 additions & 3 deletions autoload/xolox/lua.vim
Expand Up @@ -3,7 +3,7 @@
" Last Change: June 17, 2014 " Last Change: June 17, 2014
" URL: http://peterodding.com/code/vim/lua-ftplugin " 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:miscdir = expand('<sfile>:p:h:h:h') . '/misc/lua-ftplugin'
let s:omnicomplete_script = s:miscdir . '/omnicomplete.lua' let s:omnicomplete_script = s:miscdir . '/omnicomplete.lua'
let s:globals_script = s:miscdir . '/globals.lua' let s:globals_script = s:miscdir . '/globals.lua'
Expand All @@ -25,7 +25,7 @@ endfunction


function! xolox#lua#getsearchpath(envvar, luavar) " {{{1 function! xolox#lua#getsearchpath(envvar, luavar) " {{{1
let path = '' 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 to get the search path using the Lua Interface for Vim.
try try
redir => path redir => path
Expand Down Expand Up @@ -478,7 +478,7 @@ function! xolox#lua#tweakoptions() " {{{1
endfunction endfunction


function! xolox#lua#dofile(pathname, arguments) " {{{1 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. " 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) call xolox#misc#msg#debug("lua.vim %s: Running '%s' using Lua Interface for Vim ..", g:xolox#lua#version, a:pathname)
redir => output redir => output
Expand Down
34 changes: 22 additions & 12 deletions doc/ft_lua.txt
Expand Up @@ -10,18 +10,19 @@ Contents ~
2. The |lua_check_syntax| option 2. The |lua_check_syntax| option
3. The |lua_check_globals| option 3. The |lua_check_globals| option
4. The |lua_interpreter_path| option 4. The |lua_interpreter_path| option
5. The |lua_compiler_name| option 5. The |lua_internal| option
6. The |lua_compiler_args| option 6. The |lua_compiler_name| option
7. The |lua_error_format| option 7. The |lua_compiler_args| option
8. The |lua_complete_keywords| option 8. The |lua_error_format| option
9. The |lua_complete_globals| option 9. The |lua_complete_keywords| option
10. The |lua_complete_library| option 10. The |lua_complete_globals| option
11. The |lua_complete_dynamic| option 11. The |lua_complete_library| option
12. The |lua_complete_omni| option 12. The |lua_complete_dynamic| option
13. The |lua_omni_blacklist| option 13. The |lua_complete_omni| option
14. The |lua_define_completefunc| option 14. The |lua_omni_blacklist| option
15. The |lua_define_omnifunc| option 15. The |lua_define_completefunc| option
16. The |lua_define_completion_mappings| option 16. The |lua_define_omnifunc| option
17. The |lua_define_completion_mappings| option
4. Commands |ft_lua-commands| 4. Commands |ft_lua-commands|
1. The |:LuaCheckSyntax| command 1. The |:LuaCheckSyntax| command
2. The |:LuaCheckGlobals| command 2. The |:LuaCheckGlobals| command
Expand Down Expand Up @@ -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, the plug-in (for example the script that checks for undefined global variables,
see |:LuaCheckGlobals|). 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 The *lua_compiler_name* option


Expand Down

0 comments on commit 5d0ec87

Please sign in to comment.