diff --git a/README.md b/README.md index dd5922ac..4c26b296 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,9 @@ module of plugin `A`, then plugin `A` will be loaded on demand as expected. You can configure **lazy.nvim** to lazy-load all plugins by default with `config.defaults.lazy = true`. +If you don't want this behavior for a certain plugin, you can specify that with `module=false`. +You can then manually load the plugin with `:Lazy load foobar.nvim`. + Additionally, you can also lazy-load on **events**, **commands**, **file types** and **key mappings**. diff --git a/lua/lazy/core/loader.lua b/lua/lazy/core/loader.lua index 741c2afb..bd11ea8c 100644 --- a/lua/lazy/core/loader.lua +++ b/lua/lazy/core/loader.lua @@ -194,7 +194,7 @@ end function M.autoload(modname) -- check if a lazy plugin should be loaded for _, plugin in pairs(Config.plugins) do - if not plugin._.loaded then + if not (plugin._.loaded or plugin.module == false) then for _, pattern in ipairs({ ".lua", "/init.lua" }) do local path = plugin.dir .. "/lua/" .. modname:gsub("%.", "/") .. pattern if vim.loop.fs_stat(path) then diff --git a/lua/lazy/core/plugin.lua b/lua/lazy/core/plugin.lua index ee6558c3..39598b94 100644 --- a/lua/lazy/core/plugin.lua +++ b/lua/lazy/core/plugin.lua @@ -26,6 +26,7 @@ local M = {} ---@field cmd? string[] ---@field ft? string[] ---@field keys? string[] +---@field module? false ---@class LazyPluginRef ---@field branch? string