From 7b3aefee5376f5ceb274f8625b1300fcf15f3c56 Mon Sep 17 00:00:00 2001 From: siduck Date: Fri, 17 Feb 2023 22:25:31 +0530 Subject: [PATCH] add condition to merge user custom plugins --- lua/core/default_config.lua | 4 +++- lua/plugins/init.lua | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lua/core/default_config.lua b/lua/core/default_config.lua index 6e5e70b..89b9ccd 100644 --- a/lua/core/default_config.lua +++ b/lua/core/default_config.lua @@ -74,7 +74,9 @@ M.ui = { }, } -M.plugins = {} +M.plugins = "" -- path i.e "custom.plugins" -> custom/plugins.lua only and not custom/plugins/init.lua!!!! + +M.lazy_nvim = {} -- config for lazy.nvim startup options -- these are default mappings, check core.mappings for table structure M.mappings = require "core.mappings" diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 77bccbc..fea032e 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -221,11 +221,15 @@ local default_plugins = { require("which-key").setup(opts) end, }, - - { import = require("core.utils").load_config().plugins }, } --- load lazy.nvim _,opts -local lazy_config = require "plugins.configs.lazy_nvim" +local config = require("core.utils").load_config() + +if #config.plugins > 0 then + table.insert(default_plugins, { import = config.plugins }) +end + +-- lazy_nvim startup opts +local lazy_config = vim.tbl_deep_extend("force", require "plugins.configs.lazy_nvim", config.lazy_nvim) require("lazy").setup(default_plugins, lazy_config)