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

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

Merged
merged 3 commits into from
Feb 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions plug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -1031,6 +1040,11 @@ function! s:is_updated(dir)
endfunction

function! s:do(pull, force, todo)
if has('nvim')
" Reset &rtp to invalidate Neovim cache of loaded Lua modules
" See https://github.com/junegunn/vim-plug/pull/1157#issuecomment-1809226110
let &rtp = &rtp
endif
for [name, spec] in items(a:todo)
if !isdirectory(spec.dir)
continue
Expand Down
Loading