Skip to content

Commit

Permalink
Make name/path of Lua interpreter configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Jun 16, 2014
1 parent 624ee70 commit 47123ba
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -62,6 +62,10 @@ When you write a Lua script to disk the plug-in automatically runs the Lua compi

You can manually check the globals using the `:CheckGlobals` command.

### The `lua_interpreter_path` option

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_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].
Expand Down
11 changes: 6 additions & 5 deletions autoload/xolox/lua.vim
@@ -1,6 +1,6 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: August 31, 2013
" Last Change: June 16, 2014
" URL: http://peterodding.com/code/vim/lua-ftplugin

let g:xolox#lua#version = '0.7.13'
Expand Down Expand Up @@ -476,10 +476,11 @@ function! xolox#lua#dofile(pathname, arguments) " {{{1
return split(output, "\n")
else
" Use the command line Lua interpreter.
let qpath = xolox#misc#escape#shell(a:pathname)
let qargs = join(map(a:arguments, 'xolox#misc#escape#shell(v:val)'))
" TODO Make name of Lua executable configurable!
return xolox#misc#os#exec({'command': printf('lua %s %s', qpath, qargs)})['stdout']
let interpreter = xolox#misc#escape#shell(xolox#misc#option#get('lua_interpreter_path', 'lua'))
let pathname = xolox#misc#escape#shell(a:pathname)
let arguments = join(map(a:arguments, 'xolox#misc#escape#shell(v:val)'))
let command = printf('%s %s %s', interpreter, pathname, arguments)
return xolox#misc#os#exec({'command': command})['stdout']
endif
endfunction

Expand Down
30 changes: 19 additions & 11 deletions doc/ft_lua.txt
Expand Up @@ -9,17 +9,18 @@ Contents ~
1. The |lua_path| option
2. The |lua_check_syntax| option
3. The |lua_check_globals| option
4. The |lua_compiler_name| option
5. The |lua_compiler_args| option
6. The |lua_error_format| option
7. The |lua_complete_keywords| option
8. The |lua_complete_globals| option
9. The |lua_complete_library| option
10. The |lua_complete_dynamic| option
11. The |lua_complete_omni| option
12. The |lua_define_completefunc| option
13. The |lua_define_omnifunc| option
14. The |lua_define_completion_mappings| 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_define_completefunc| option
14. The |lua_define_omnifunc| option
15. The |lua_define_completion_mappings| option
4. Commands |ft_lua-commands|
1. The |:LuaCheckSyntax| command
2. The |:LuaCheckGlobals| command
Expand Down Expand Up @@ -140,6 +141,13 @@ can set this option to false (0):
<
You can manually check the globals using the ':CheckGlobals' command.

-------------------------------------------------------------------------------
The *lua_interpreter_path* option

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_compiler_name* option

Expand Down

0 comments on commit 47123ba

Please sign in to comment.