From 334f32e595055e7170347f543031224cd36f3466 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 30 Nov 2022 23:08:40 +0100 Subject: [PATCH] refactor: renamed Config.opt => Config.defaults.opt --- lua/lazy/core/config.lua | 5 ++++- lua/lazy/core/plugin.lua | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua index 9e036536..f2eeca8b 100644 --- a/lua/lazy/core/config.lua +++ b/lua/lazy/core/config.lua @@ -4,8 +4,11 @@ local M = {} ---@class LazyConfig M.defaults = { - opt = true, plugins = "config.plugins", + defaults = { + opt = false, -- should plugins default to "opt" or "start" + -- version = "*", -- enable this to try installing the latest stable versions of plugins + }, dev = { path = vim.fn.expand("~/projects"), -- the path where you store your projects ---@type string[] diff --git a/lua/lazy/core/plugin.lua b/lua/lazy/core/plugin.lua index 41cac424..1436f993 100644 --- a/lua/lazy/core/plugin.lua +++ b/lua/lazy/core/plugin.lua @@ -160,14 +160,14 @@ function M.update_state() for _, plugin in pairs(Config.plugins) do plugin._ = plugin._ or {} if plugin.opt == nil then - plugin.opt = plugin.dep - or Config.options.opt + local opt = plugin.dep + or Config.options.defaults.opt or plugin.module or plugin.event or plugin.keys or plugin.ft or plugin.cmd - plugin.opt = plugin.opt and true or false + plugin.opt = opt and true or false end local opt = plugin.opt and "opt" or "start" plugin.dir = Config.options.packpath .. "/" .. opt .. "/" .. plugin.name