mirror of
https://github.com/zoriya/lz.n.git
synced 2026-05-29 17:34:27 +00:00
chore: cleanup some todos, implement loading hook API
This commit is contained in:
@@ -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
@@ -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
@@ -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>
|
||||
|
||||
@@ -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
@@ -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",
|
||||
-- },
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user