Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add support for g:lua_path #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 13 additions & 2 deletions autoload/xolox/lua.vim
Expand Up @@ -23,9 +23,16 @@ function! xolox#lua#includeexpr(fname) " {{{1
return a:fname
endfunction

let s:lua_path_cache = ['', []]
function! xolox#lua#getsearchpath(envvar, luavar) " {{{1
if exists('g:lua_path') && s:lua_path_cache[0] == g:lua_path
return s:lua_path_cache[1]
endif

let path = ''
if xolox#misc#option#get('lua_internal', has('lua'))
if exists('g:lua_path')
let path = g:lua_path
elseif xolox#misc#option#get('lua_internal', has('lua'))
" Try to get the search path using the Lua Interface for Vim.
try
redir => path
Expand All @@ -36,6 +43,7 @@ function! xolox#lua#getsearchpath(envvar, luavar) " {{{1
redir END
endtry
endif

if empty(path)
let path = eval(a:envvar)
if !empty(path)
Expand All @@ -51,7 +59,10 @@ function! xolox#lua#getsearchpath(envvar, luavar) " {{{1
endtry
endif
endif
return split(xolox#misc#str#trim(path), ';')

let g:lua_path = path
let s:lua_path_cache = [path, split(xolox#misc#str#trim(path), ';')]
return s:lua_path_cache[1]
endfunction

function! xolox#lua#autocheck() " {{{1
Expand Down