mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 02:50:06 +08:00
Refactor lua initialization (#3065)
This commit is contained in:
parent
7764c038c1
commit
b2dc3cc8fa
@ -52,45 +52,30 @@ function! SpaceVim#layers#lang#lua#config() abort
|
|||||||
augroup END
|
augroup END
|
||||||
call SpaceVim#mapping#space#regesit_lang_mappings('lua', function('s:language_specified_mappings'))
|
call SpaceVim#mapping#space#regesit_lang_mappings('lua', function('s:language_specified_mappings'))
|
||||||
let luaexe = filter(['lua53', 'lua52', 'lua51'], 'executable(v:val)')
|
let luaexe = filter(['lua53', 'lua52', 'lua51'], 'executable(v:val)')
|
||||||
if !empty(luaexe)
|
let exe_lua = empty(luaexe) ? 'lua' : luaexe[0]
|
||||||
call SpaceVim#plugins#runner#reg_runner('lua', {
|
call SpaceVim#plugins#runner#reg_runner('lua', {
|
||||||
\ 'exe' : luaexe[0],
|
\ 'exe' : exe_lua,
|
||||||
\ 'opt' : ['-'],
|
\ 'opt' : ['-'],
|
||||||
\ 'usestdin' : 1,
|
\ 'usestdin' : 1,
|
||||||
\ })
|
\ })
|
||||||
else
|
|
||||||
call SpaceVim#plugins#runner#reg_runner('lua', {
|
|
||||||
\ 'exe' : 'lua',
|
|
||||||
\ 'opt' : ['-'],
|
|
||||||
\ 'usestdin' : 1,
|
|
||||||
\ })
|
|
||||||
endif
|
|
||||||
let g:neomake_lua_enabled_makers = ['luac']
|
let g:neomake_lua_enabled_makers = ['luac']
|
||||||
let luacexe = filter(['luac53', 'luac52', 'luac51'], 'executable(v:val)')
|
let luacexe = filter(['luac53', 'luac52', 'luac51'], 'executable(v:val)')
|
||||||
if !empty(luacexe)
|
let exe_luac = empty(luacexe) ? 'luac' : luacexe[0]
|
||||||
let g:neomake_lua_luac_maker = {
|
let g:neomake_lua_luac_maker = {
|
||||||
\ 'exe': luacexe[0],
|
\ 'exe': exe_luac,
|
||||||
\ 'args': ['-p'],
|
\ 'args': ['-p'],
|
||||||
\ 'errorformat': '%*\f: %#%f:%l: %m',
|
\ 'errorformat': '%*\f: %#%f:%l: %m',
|
||||||
\ }
|
\ }
|
||||||
else
|
|
||||||
let g:neomake_lua_luac_maker = {
|
|
||||||
\ 'exe': 'luac',
|
|
||||||
\ 'args': ['-p'],
|
|
||||||
\ 'errorformat': '%*\f: %#%f:%l: %m',
|
|
||||||
\ }
|
|
||||||
endif
|
|
||||||
if !empty(s:lua_repl_command)
|
if !empty(s:lua_repl_command)
|
||||||
call SpaceVim#plugins#repl#reg('lua',s:lua_repl_command)
|
let lua_repl = s:lua_repl_command
|
||||||
else
|
elseif executable('luap')
|
||||||
if executable('luap')
|
let lua_repl = 'luap'
|
||||||
call SpaceVim#plugins#repl#reg('lua', 'luap')
|
|
||||||
elseif !empty(luaexe)
|
elseif !empty(luaexe)
|
||||||
call SpaceVim#plugins#repl#reg('lua', luaexe + ['-i'])
|
let lua_repl = luaexe[0] + ['-i'])
|
||||||
else
|
else
|
||||||
call SpaceVim#plugins#repl#reg('lua', ['lua', '-i'])
|
let lua_repl = ['lua', '-i']
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
call SpaceVim#plugins#repl#reg('lua', lua_repl)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#layers#lang#lua#set_variable(opt) abort
|
function! SpaceVim#layers#lang#lua#set_variable(opt) abort
|
||||||
|
Loading…
Reference in New Issue
Block a user