浏览代码

Source lua files (if any) from rtp when loading a plugin

Neovim 0.5.0 allows lua files to be used in runtime files (such as
plugin, ftdetect, etc.) as well as vimscript files. Indeed, some
plugins have `plugin/*.lua` scripts only, but not `plugin/*.vim`;
such plugins cannot be sourced and work properly if it is lazy-loaded.
Jongwook Choi 3 年之前
父节点
当前提交
64b9f9e3c3
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      plug.vim

+ 9 - 0
plug.vim

@@ -391,6 +391,9 @@ function! plug#end()
       if !empty(types)
         augroup filetypedetect
         call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim')
+        if has('nvim-0.5.0')
+            call s:source(s:rtp(plug), 'ftdetect/**/*.lua', 'after/ftdetect/**/*.lua')
+        endif
         augroup END
       endif
       for type in types
@@ -438,6 +441,9 @@ endfunction
 
 function! s:load_plugin(spec)
   call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim')
+  if has('nvim-0.5.0')
+    call s:source(s:rtp(a:spec), 'plugin/**/*.lua', 'after/plugin/**/*.lua')
+  endif
 endfunction
 
 function! s:reload_plugins()
@@ -655,6 +661,9 @@ function! s:lod(names, types, ...)
     let rtp = s:rtp(g:plugs[name])
     for dir in a:types
       call s:source(rtp, dir.'/**/*.vim')
+      if has('nvim-0.5.0')  " see neovim#14686
+        call s:source(rtp, dir.'/**/*.lua')
+      endif
     endfor
     if a:0
       if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2))