nvim: pcall the minuet require so a failed install cannot kill the config

vim.pack.add installs on first launch and that needs to reach github, which is
not a given on a work-issued machine behind a proxy. A hard require there takes
down everything below it -- MinuetStatus, the colorscheme, the lot -- and
reports an error pointing at minuet rather than at the network.

MinuetStatus is now registered unconditionally and reports whether the plugin
loaded at all. A status command that only exists once everything already works
is not a status command.
This commit is contained in:
connor committed 2026-09-20 21:24:53 -04:00
1 parent 4cc6783438
commit c01345b216
1 file changed
+13 -2
+13 -2
View File
@@ -167,7 +167,14 @@ if not minuet_base or minuet_base == "" then
minuet_base = "https://llm.rcjohnstone.com"
end
require("minuet").setup({
-- ⚠ pcall, because a hard require here takes the WHOLE config down with it.
-- `vim.pack.add` installs on first launch, and that needs to reach github --
-- which is not a given on a work-issued machine behind a proxy. Without this,
-- a failed install means no MinuetStatus, no colorscheme, no anything below
-- this line, and an error that points at minuet rather than at the network.
local minuet_ok, minuet = pcall(require, "minuet")
if minuet_ok then
minuet.setup({
provider = "openai_fim_compatible",
-- Default is 'warn', which hides request failures. If completions stop
-- appearing, set this to 'debug' and the reason shows up in `:messages`.
@@ -222,11 +229,15 @@ require("minuet").setup({
},
},
})
end
-- Because "is it on, and if not why" should be answerable without reading Lua.
-- Registered UNCONDITIONALLY, so it can report the case where the plugin
-- itself is missing. A status command that only exists when everything
-- already works is not a status command.
vim.api.nvim_create_user_command("MinuetStatus", function()
local k = minuet_key()
local lines = {
"plugin: " .. (minuet_ok and "loaded" or "NOT INSTALLED -- run :lua vim.pack.update()"),
"endpoint: " .. minuet_base .. "/v1/completions",
"model: qwen3-coder-30b",
"key: " .. (k and ("found (" .. #k .. " chars)") or "NOT FOUND"),