Skip to content

Commit 0de2b6d

Browse files
authored
fix(vim.pack): error if git is not installed (#995)
1 parent df2a1f9 commit 0de2b6d

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

lua/catppuccin/lib/detect_integrations.lua

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ function M.detect_plugins()
99
local installed_plugins = {}
1010

1111
if vim.fn.has "nvim-0.12.0" == 1 then
12-
vim.list_extend(
13-
installed_plugins,
14-
vim.iter(vim.pack.get()):map(function(plugin) return plugin.spec.name end):totable()
15-
)
12+
-- NOTE: `info = false` prevents vim.pack from trying to use git to get additional info
13+
local ok, plugins = pcall(vim.pack.get, nil, { info = false })
14+
if not ok then
15+
vim.notify("unable to detect plugins using vim.pack: " .. (plugins or ""), vim.log.levels.WARN)
16+
else
17+
vim.list_extend(
18+
installed_plugins,
19+
vim.iter(plugins):map(function(plugin) return plugin.spec.name end):totable()
20+
)
21+
end
1622
end
1723

1824
if pcall(require, "pckr") then vim.list_extend(installed_plugins, require("pckr.plugin").plugins_by_name) end

0 commit comments

Comments
 (0)