mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-20 23:51:12 +08:00
Load plugins only once in plug#load (#616)
When loading 'deoplete.nvim' for the 2nd time during InsertEnter manually, the `s:dobufread` (or `s:lod` itself) prevents it to work properly - likely because the plugin gets resourced. Maybe there could be a way to force this (and reload plugins always), but by default it seems to make sense to skip already loaded plugins.
This commit is contained in:
committed by
Junegunn Choi
parent
1d3c88292b
commit
9dcab48628
14
plug.vim
14
plug.vim
@@ -447,11 +447,15 @@ function! plug#load(...)
|
||||
let s = len(unknowns) > 1 ? 's' : ''
|
||||
return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', ')))
|
||||
end
|
||||
for name in a:000
|
||||
call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||
endfor
|
||||
call s:dobufread(a:000)
|
||||
return 1
|
||||
let unloaded = filter(copy(a:000), '!get(s:loaded, v:val, 0)')
|
||||
if !empty(unloaded)
|
||||
for name in unloaded
|
||||
call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||
endfor
|
||||
call s:dobufread(unloaded)
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! s:remove_triggers(name)
|
||||
|
||||
Reference in New Issue
Block a user