Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use configured Lua compiler in globals.lua (reported in pull request #23

)
  • Loading branch information...
commit 96082b731ddb620c9b180316d8a708fefe06b7b9 1 parent 9160dee
@xolox authored
Showing with 13 additions and 4 deletions.
  1. +3 −2 autoload/xolox/lua.vim
  2. +10 −2 misc/lua-ftplugin/globals.lua
View
5 autoload/xolox/lua.vim
@@ -3,7 +3,7 @@
" Last Change: June 16, 2014
" URL: http://peterodding.com/code/vim/lua-ftplugin
-let g:xolox#lua#version = '0.7.17'
+let g:xolox#lua#version = '0.7.18'
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'
@@ -134,7 +134,8 @@ endfunction
function! xolox#lua#checkglobals(verbose) " {{{1
let curfile = expand('%')
call xolox#misc#msg#debug("lua.vim %s: Checking for undefined globals in '%s' using '%s' ..", g:xolox#lua#version, curfile, s:globals_script)
- let output = xolox#lua#dofile(s:globals_script, [curfile, a:verbose])
+ let compiler = xolox#misc#option#get('lua_compiler_name', 'luac')
+ let output = xolox#lua#dofile(s:globals_script, [compiler, curfile, a:verbose])
call setqflist(eval('[' . join(output, ',') . ']'), 'r')
cwindow
endfunction
View
12 misc/lua-ftplugin/globals.lua
@@ -1,8 +1,16 @@
#!/usr/bin/env lua
+-- Unpack arguments from Vim.
+local compiler = arg[1]
+local filename = arg[2]
+local verbose = tonumber(arg[3]) ~= 0
+
+local function quote(s)
+ return string.format('"%s"', (s:gsub('["\\]', '\\%0')))
+end
+
-- Parse output of "luac -l" for GETGLOBAL/SETGLOBAL instructions.
-local command = string.format('luac -p -l "%s"', arg[1])
-local verbose = tonumber(arg[2]) ~= 0
+local command = string.format('%s -p -l %s', quote(compiler), quote(filename))
local compiler = io.popen(command)
local matches = {}
for line in compiler:lines() do
Please sign in to comment.
Something went wrong with that request. Please try again.