From ddcafa726fe7c7ca5d8c8ef9c0e82e73c14095d6 Mon Sep 17 00:00:00 2001 From: Xarvex Date: Thu, 6 Jun 2024 21:12:54 -0500 Subject: [PATCH] feat: configurable default pinning of plugins --- README.md | 1 + doc/lazy.nvim.txt | 1 + lua/lazy/core/config.lua | 1 + lua/lazy/core/plugin.lua | 3 +++ 4 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 9bde4f9..fa61f37 100644 --- a/README.md +++ b/README.md @@ -300,6 +300,7 @@ return { defaults = { lazy = false, -- should plugins be lazy-loaded? version = nil, + pin = false, -- default `cond` you can use to globally disable a lot of plugins -- when running inside vscode for example cond = nil, ---@type boolean|fun(self:LazyPlugin):boolean|nil diff --git a/doc/lazy.nvim.txt b/doc/lazy.nvim.txt index b07aad4..21627d4 100644 --- a/doc/lazy.nvim.txt +++ b/doc/lazy.nvim.txt @@ -404,6 +404,7 @@ CONFIGURATION *lazy.nvim-lazy.nvim-configuration* defaults = { lazy = false, -- should plugins be lazy-loaded? version = nil, + pin = false, -- default `cond` you can use to globally disable a lot of plugins -- when running inside vscode for example cond = nil, ---@type boolean|fun(self:LazyPlugin):boolean|nil diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua index f01e6a9..11072ff 100644 --- a/lua/lazy/core/config.lua +++ b/lua/lazy/core/config.lua @@ -9,6 +9,7 @@ M.defaults = { defaults = { lazy = false, -- should plugins be lazy-loaded? version = nil, + pin = false, -- default `cond` you can use to globally disable a lot of plugins -- when running inside vscode for example cond = nil, ---@type boolean|fun(self:LazyPlugin):boolean|nil diff --git a/lua/lazy/core/plugin.lua b/lua/lazy/core/plugin.lua index 905c078..c752333 100644 --- a/lua/lazy/core/plugin.lua +++ b/lua/lazy/core/plugin.lua @@ -515,6 +515,9 @@ function M.update_state() or plugin.cmd plugin.lazy = lazy and true or false end + if plugin.pin == nil then + plugin.pin = Config.options.defaults.pin + end if plugin.dir:find(Config.options.root, 1, true) == 1 then plugin._.installed = installed[plugin.name] ~= nil installed[plugin.name] = nil