refactor(undotree): use builtin nvim.undotree

This commit is contained in:
2026-04-21 14:24:42 +02:00
parent 21f566112e
commit 3611791fa9
4 changed files with 30 additions and 3 deletions
+26 -1
View File
@@ -75,6 +75,12 @@ local function load(name, required)
end
end
---@param src string
---@return boolean
local function is_url(src)
return src:find("://") ~= nil
end
---@param spec string | ow.Pack.PluginSpec
---@return vim.pack.Spec
local function to_pack_spec(spec)
@@ -233,7 +239,26 @@ end
---@param specs (string | ow.Pack.PluginSpec)[]
function M.setup(specs)
local changed = M.install(vim.tbl_map(to_pack_spec, specs), function(data)
local pack_specs = {}
for _, spec in ipairs(specs) do
local src = type(spec) == "string" and spec or spec[1]
if is_url(src) then
table.insert(pack_specs, to_pack_spec(spec))
else
vim.cmd.packadd(src)
local runtime =
vim.api.nvim_get_runtime_file("pack/*/opt/" .. src, false)
---@type ow.Pack.Plugin
local plugin = {
[1] = src,
name = src,
path = runtime[1] or "",
}
table.insert(M.plugins, plugin)
end
end
local changed = M.install(pack_specs, function(data)
if not data.spec.name then
log.error("Missing name for plugin: %s", data.spec.src)
return