-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathdump_plugins.lua
More file actions
59 lines (52 loc) · 1.29 KB
/
dump_plugins.lua
File metadata and controls
59 lines (52 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
-- Ensure we can load modules from current directory
vim.opt.rtp:prepend(vim.fn.getcwd())
-- Mock libs.notify to avoid errors if it relies on plugins
package.loaded["libs.notify"] = {
error = function(...)
local args = { ... }
print("Error:", table.concat(args, " "))
end,
info = function(...)
local args = { ... }
print("Info:", table.concat(args, " "))
end,
}
-- Require the pack module to get access to registry
local pack = require("pack")
-- Manually load the configuration modules that register plugins
-- These mirror the list in lua/pack.lua's collect_plugins
local modules = {
"completion",
"git",
"lang",
"tools",
"treesitter",
"ui",
}
for _, mod in ipairs(modules) do
local ok, err = pcall(require, mod)
if not ok then
print("Failed to load " .. mod .. ": " .. tostring(err))
end
end
-- Collect specs
local specs = pack.specs
local output = {}
for _, spec in ipairs(specs) do
table.insert(output, {
name = spec.name,
src = spec.src,
rev = spec.rev,
hash = spec.hash,
})
end
-- Write to JSON
local f = io.open("plugins.json", "w")
if f then
-- Pretty print
f:write(vim.json.encode(output))
f:close()
print("Successfully dumped " .. #output .. " plugins to plugins.json")
else
print("Error opening plugins.json for writing")
end