From 2dd66af69284408669ae49bfafb2360eb253a578 Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Joshua Bell)" Date: Tue, 30 Apr 2024 11:58:33 -0500 Subject: [PATCH] auto import plugin configs --- init.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index ef900da..d49570c 100644 --- a/init.lua +++ b/init.lua @@ -38,13 +38,18 @@ print("TEST") -- Setup lazy function getSpec() if NVIM_CONFIG_STORE_PATH then - -- TODO use same strategy as the tools/init.lua to auto import these - return { require("plugins.catppuccin") } + local plugins = {} + local plugins_path = debug.getinfo(2, "S").source:sub(2):match("(.*/)") .. "lua/plugins" + for _, file in ipairs(vim.fn.readdir(plugins_path, [[v:val =~ '\.lua$']])) do + local plugin = string.sub(file, 0, -5) + table.insert(plugins, require("plugins." .. plugin)) + end + return plugins else -- TODO I want this to work in the nixos version - -- but it is not resolving properly to the nix store. + -- but it is not resolving properly to the nix store. -- Will revisit at some point, instead we manually pull them - -- in above. + -- in above with a directory scan. return { { import = "plugins" } } end end