Skip to content

Commit

Permalink
Check lua
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Jan 23, 2024
1 parent d685588 commit a9c6854
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
18 changes: 12 additions & 6 deletions autoload/dein/parse.vim
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ function! dein#parse#_add(repo, options, overwrite) abort
endif

" Convert lua_xxx keys
for [key, val] in plugin->items()->filter({ _, v -> v[0] =~# '^lua_' })
let hook_key = key->substitute('^lua_', 'hook_', '')
let plugin[hook_key] = printf(
\ "lua <<EOF\n%s\nEOF\n%s", val, plugin->get(hook_key, ''))
endfor
if has('nvim') || has('lua')
for [key, val] in plugin->items()->filter({ _, v -> v[0] =~# '^lua_' })
let hook_key = key->substitute('^lua_', 'hook_', '')
let plugin[hook_key] = printf(
\ "lua <<EOF\n%s\nEOF\n%s", val, plugin->get(hook_key, ''))
endfor
endif

if plugin->has_key('hook_add')
call dein#util#_call_hook('add', plugin)
Expand Down Expand Up @@ -201,7 +203,7 @@ function! dein#parse#_load_toml(filename, default) abort
call extend(toml, dein#parse#_hooks_file(hooks_file))
endfor
endif
if toml->has_key('lua_add')
if toml->has_key('lua_add') && (has('nvim') || has('lua'))
let g:dein#_hook_add ..= printf("\nlua <<EOF\n%s\nEOF", toml.lua_add)
endif
if toml->has_key('hook_add')
Expand Down Expand Up @@ -422,6 +424,10 @@ endfunction
function! s:merge_ftplugin(ftplugin) abort
for [ft, val] in a:ftplugin->items()
if ft->stridx('lua_') == 0
if !has('nvim') && !has('lua')
continue
endif

" Convert lua_xxx keys
let ft = ft->substitute('^lua_', '', '')
let val = "lua <<EOF\n" .. val .. "\nEOF"
Expand Down
6 changes: 6 additions & 0 deletions doc/dein.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1198,31 +1198,37 @@ hook_source (String) or (Function)
lua_add (String)
Lua language string hook instead of Vim script.
It is converted to |dein-options-hook_add| key.
NOTE: It works only for neovim or |+lua|.

*dein-options-lua_depends_update*
lua_depends_update (String)
Lua language string hook instead of Vim script.
It is converted to |dein-options-lua_depends_update| key.
NOTE: It works only for neovim or |+lua|.

*dein-options-lua_done_update*
lua_done_update (String)
Lua language string hook instead of Vim script.
It is converted to |dein-options-lua_done_update| key.
NOTE: It works only for neovim or |+lua|.

*dein-options-lua_post_source*
lua_post_source (String)
Lua language string hook instead of Vim script.
It is converted to |dein-options-lua_post_source| key.
NOTE: It works only for neovim or |+lua|.

*dein-options-lua_post_update*
lua_post_update (String)
Lua language string hook instead of Vim script.
It is converted to |dein-options-lua_post_update| key.
NOTE: It works only for neovim or |+lua|.

*dein-options-lua_source*
lua_source (String)
Lua language string hook instead of Vim script.
It is converted to |dein-options-lua_source| key.
NOTE: It works only for neovim or |+lua|.

------------------------------------------------------------------------------
TOML *dein-toml*
Expand Down

0 comments on commit a9c6854

Please sign in to comment.