Skip to content

Commit 5d0ec87

Browse files
committed
Make it possible to disable use of Lua Interface for Vim
Relevant for issue #20: #20
1 parent aa7a642 commit 5d0ec87

File tree

3 files changed

+30
-15
lines changed

3 files changed

+30
-15
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ You can manually check the globals using the `:CheckGlobals` command.
6666

6767
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`).
6868

69+
### The `lua_internal` option
70+
71+
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.
72+
6973
### The `lua_compiler_name` option
7074

7175
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
165169
[gf]: http://vimdoc.sourceforge.net/htmldoc/editing.html#gf
166170
[github-lua-ftplugin]: http://github.com/xolox/vim-lua-ftplugin
167171
[github-misc]: http://github.com/xolox/vim-misc
172+
[if_lua.txt]: http://vimdoc.sourceforge.net/htmldoc/if_lua.html#if_lua.txt
168173
[inc]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27include%27
169174
[inex]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27includeexpr%27
170175
[ll]: http://lua-users.org/wiki/LuaLint

autoload/xolox/lua.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Last Change: June 17, 2014
44
" URL: http://peterodding.com/code/vim/lua-ftplugin
55

6-
let g:xolox#lua#version = '0.7.20'
6+
let g:xolox#lua#version = '0.7.21'
77
let s:miscdir = expand('<sfile>:p:h:h:h') . '/misc/lua-ftplugin'
88
let s:omnicomplete_script = s:miscdir . '/omnicomplete.lua'
99
let s:globals_script = s:miscdir . '/globals.lua'
@@ -25,7 +25,7 @@ endfunction
2525

2626
function! xolox#lua#getsearchpath(envvar, luavar) " {{{1
2727
let path = ''
28-
if has('lua')
28+
if xolox#misc#option#get('lua_internal', has('lua'))
2929
" Try to get the search path using the Lua Interface for Vim.
3030
try
3131
redir => path
@@ -478,7 +478,7 @@ function! xolox#lua#tweakoptions() " {{{1
478478
endfunction
479479

480480
function! xolox#lua#dofile(pathname, arguments) " {{{1
481-
if has('lua')
481+
if xolox#misc#option#get('lua_internal', has('lua'))
482482
" Use the Lua Interface for Vim.
483483
call xolox#misc#msg#debug("lua.vim %s: Running '%s' using Lua Interface for Vim ..", g:xolox#lua#version, a:pathname)
484484
redir => output

doc/ft_lua.txt

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@ Contents ~
1010
2. The |lua_check_syntax| option
1111
3. The |lua_check_globals| option
1212
4. The |lua_interpreter_path| option
13-
5. The |lua_compiler_name| option
14-
6. The |lua_compiler_args| option
15-
7. The |lua_error_format| option
16-
8. The |lua_complete_keywords| option
17-
9. The |lua_complete_globals| option
18-
10. The |lua_complete_library| option
19-
11. The |lua_complete_dynamic| option
20-
12. The |lua_complete_omni| option
21-
13. The |lua_omni_blacklist| option
22-
14. The |lua_define_completefunc| option
23-
15. The |lua_define_omnifunc| option
24-
16. The |lua_define_completion_mappings| option
13+
5. The |lua_internal| option
14+
6. The |lua_compiler_name| option
15+
7. The |lua_compiler_args| option
16+
8. The |lua_error_format| option
17+
9. The |lua_complete_keywords| option
18+
10. The |lua_complete_globals| option
19+
11. The |lua_complete_library| option
20+
12. The |lua_complete_dynamic| option
21+
13. The |lua_complete_omni| option
22+
14. The |lua_omni_blacklist| option
23+
15. The |lua_define_completefunc| option
24+
16. The |lua_define_omnifunc| option
25+
17. The |lua_define_completion_mappings| option
2526
4. Commands |ft_lua-commands|
2627
1. The |:LuaCheckSyntax| command
2728
2. The |:LuaCheckGlobals| command
@@ -150,6 +151,15 @@ The name or path of the Lua interpreter used to evaluate Lua scripts used by
150151
the plug-in (for example the script that checks for undefined global variables,
151152
see |:LuaCheckGlobals|).
152153

154+
-------------------------------------------------------------------------------
155+
The *lua_internal* option
156+
157+
If you're running a version of Vim that supports the Lua Interface for Vim (see
158+
|if_lua.txt|) then all Lua code evaluated by the Lua file type plug-in is
159+
evaluated using the Lua Interface for Vim. If the Lua Interface for Vim is not
160+
available the plug-in falls back to using an external Lua interpreter. You can
161+
set this to false (0) to force the plug-in to use an external Lua interpreter.
162+
153163
-------------------------------------------------------------------------------
154164
The *lua_compiler_name* option
155165

0 commit comments

Comments
 (0)