chore: cleanup some todos, implement loading hook API

This commit is contained in:
Marc Jakobi
2024-06-10 10:09:38 +02:00
parent 2b98d3ab0a
commit e2417bd758
5 changed files with 15 additions and 11 deletions
-2
View File
@@ -26,13 +26,11 @@ local function enable(plugin)
for _, handler in pairs(handlers) do
handler.add(plugin)
end
-- TODO: Change handler add implementations to take a lz.n.Plugin
end
function M.disable(plugin)
for _, handler in pairs(handlers) do
if type(handler.del) == "function" then
-- TODO: Change handler del implementations to take a lz.n.Plugin?
handler.del(plugin)
end
end
+1 -2
View File
@@ -2,8 +2,7 @@
local M = {}
-- TODO: Is this necessary?
if not vim.loader or vim.fn.has("nvim-0.9.1") ~= 1 then
if vim.fn.has("nvim-0.9.1") ~= 1 then
error("lz.n requires Neovim >= 0.9.1")
end
+7 -1
View File
@@ -13,7 +13,13 @@ function M._load(plugin)
return
end
require("lz.n.handler").disable(plugin)
-- TODO: Load plugin
---@type fun(name: string) | nil
local load_impl = vim.tbl_get(vim.g, "lz_n", "load")
if type(load_impl) == "function" then
load_impl(plugin.name)
else
vim.cmd.packadd(plugin.name)
end
end
---@param plugins table<string, lz.n.Plugin>
+6
View File
@@ -76,3 +76,9 @@ error("Cannot import a meta module")
---@field import string spec module to import
---@field enabled? boolean|(fun():boolean)
---@field cond? boolean|(fun():boolean)
---@class lz.n.Config
---@field load? fun(name: string) Function to load a plugin. Takes the plugin name (not the module name). Defaults to |packadd| if not set.
---@type lz.n.Config
vim.g.lz_n = vim.g.lz_n
+1 -6
View File
@@ -15,16 +15,11 @@ test_dependencies = {
}
source = {
url = 'git://github.com/mrcjkb/' .. package,
url = 'git://github.com/nvim-neorocks/' .. package,
}
build = {
type = 'builtin',
-- TODO: Add runtime diretories here
-- copy_directories = {
-- 'doc',
-- "plugin",
-- },
}