-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
On-demand loading plugins without 'plugin', 'ftdetect', 'after/ftdetect', and 'after/plugin' directories #1135
Comments
function! s:lazy(plug, opt)
return has_key(a:plug, a:opt) &&
\ (empty(s:to_a(a:plug[a:opt])) ||
\ !isdirectory(a:plug.dir) ||
\ len(s:glob(s:rtp(a:plug), 'plugin')) ||
\ len(s:glob(s:rtp(a:plug), 'after/plugin')))
endfunction Expected behavior because on-demand loading is meant for |
I have to add that I strongly advise against using https://github.com/junegunn/vim-plug/wiki/faq#when-should-i-use-on-or-for-option If a plugin has a startup-time problem, you should report that to the author of the plugin, so that they fix properly address the issue. |
@janlazo On-demand loading does not affect only This, whether the plugin is loaded or not, affects Why would loading the I understand what on-demand loading is for. It speeds up startup-time of Neovim by keeping the |
@junegunn Yes, I agree with you that on-demand loading is used rarely these days. But… My configuration of Neovim consists of about 40 plugins. None of them has a lot in Struggling with performance issue I writed a new configuration. All plugins are loaded lazily and they are loaded automatically (by a module-based solution) when they are needed. In this case it is important to have possibility to "disable" a specific plugin, it is --- have it unloaded. Can't I really disable a plugin that is written in lua, just because there is no |
In my opinion, behavior introduced as an "expected" one is more intuitive: if the user wants to have a module unloaded, let it be unloaded. However, if you don't agree with me, no problem. Thank you (@janlazo) for pointing me the relevant commit. Thank you @junegunn for maintaining the best plugin manager I have ever seen. |
Should be fixed by #1157 |
There are two plugins written in lua, let say completion-nvim and lsp-status.nvim.
Looking at their structure, they are almost the same. They both have
lua
directory and they are both loaded usingrequire
. The main --- in this case --- difference is thatcompletion-nvim
containsplugin
folder, butlsp-status.nvim
does not.Both
completion-nvim
andlsp-status.nvim
are set to be loaded lazily (on demand):So after opening Neovim none of them should be loaded. However, it is not clear why it is not the case.
:PlugStatus
reports thatcompletion-nvim
is not loaded, butlsp-status.nvim
is. Requesting modulecompletion-nvim
withrequire
populates error, butlsp-status.nvim
loads well.completion-nvim
cannot be found in the runtimepath, butlsp-status.nvim
is listed and so on.Adding
plugin
orafter/plugin
orftdetect
orafter/ftdetect
folder tolsp-status.nvim
resolves problem,lsp-status.nvim
becomes treated asnot loaded
. This fix applies to any other cases.Summary
Current behavior
Plugins without any of the directories listed in the title cannot be loaded on-demand, it's they are added to
runtimepath
at startup. This behavior makes it impossible to load plugins (withlua
directory only) on-demand what is essential to restrictspecific modules.
Expected behavior
Any plugin that is marked to be loaded lazily should not be loaded at startup, even if the plugin does not include folders listed in the title.
The text was updated successfully, but these errors were encountered: