From 429b561ff479f1845077767e93e62167a3bea090 Mon Sep 17 00:00:00 2001 From: kokopi-dev Date: Mon, 13 Apr 2026 21:48:04 +0900 Subject: [PATCH] cleanup --- nvim/lua/plugins/registry.lua | 8 ++++---- nvim/lua/utils/lazy.lua | 4 ++-- nvim/lua/utils/pack.lua | 15 ++++++--------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/nvim/lua/plugins/registry.lua b/nvim/lua/plugins/registry.lua index 5d00753..85eae80 100644 --- a/nvim/lua/plugins/registry.lua +++ b/nvim/lua/plugins/registry.lua @@ -31,11 +31,11 @@ M.map = { function M.by_names(names) local out = {} for _, name in ipairs(names) do - local spec = M.map[name] - if not spec then - error("Unknown plugin spec: " .. tostring(name)) + local entry = M.map[name] + if not entry then + error("Unknown plugin registry entry: " .. tostring(name)) end - table.insert(out, spec) + table.insert(out, entry) end return out end diff --git a/nvim/lua/utils/lazy.lua b/nvim/lua/utils/lazy.lua index 5c8bb68..e4c5c94 100644 --- a/nvim/lua/utils/lazy.lua +++ b/nvim/lua/utils/lazy.lua @@ -2,12 +2,12 @@ local M = {} local loaded = {} -function M.load_once(key, specs, setup) +function M.load_once(key, plugins, setup) if loaded[key] then return end loaded[key] = true - vim.pack.add(specs) + vim.pack.add(plugins) if setup then setup() end diff --git a/nvim/lua/utils/pack.lua b/nvim/lua/utils/pack.lua index 888ba02..9e83e28 100644 --- a/nvim/lua/utils/pack.lua +++ b/nvim/lua/utils/pack.lua @@ -6,9 +6,6 @@ function M.registry(names) return registry.by_names(names) end --- Backward-compatible alias -M.specs = M.registry - function M.add(names, opts) vim.pack.add(M.registry(names), opts) end @@ -23,8 +20,8 @@ function M.setup() vim.api.nvim_create_autocmd("PackChanged", { group = group, callback = function(ev) - local name, kind = ev.data.spec.name, ev.data.kind - if name == "nvim-treesitter" and kind == "update" then + local plugin_name, kind = ev.data.spec.name, ev.data.kind + if plugin_name == "nvim-treesitter" and kind == "update" then if not ev.data.active then vim.cmd.packadd("nvim-treesitter") end @@ -64,11 +61,11 @@ function M.setup() vim.api.nvim_create_user_command("PackClean", function() local stale = vim.iter(vim.pack.get()) - :filter(function(p) - return not p.active + :filter(function(plugin) + return not plugin.active end) - :map(function(p) - return p.spec.name + :map(function(plugin) + return plugin.spec.name end) :totable()