Add AI inline completion via minuet + OpenCode Go
Configure minuet-ai.nvim with the OpenCode Go chat completions endpoint (deepseek-v4-flash, thinking disabled) and wire it into blink.cmp as a completion source with manual <A-y> trigger.
This commit is contained in:
@@ -10,9 +10,28 @@ require("blink.cmp").setup({
|
||||
},
|
||||
completion = {
|
||||
documentation = { auto_show = false },
|
||||
trigger = { prefetch_on_insert = false },
|
||||
},
|
||||
sources = {
|
||||
default = { "lsp", "path", "snippets", "buffer" },
|
||||
default = { "lsp", "path", "snippets", "minuet", "buffer" },
|
||||
providers = {
|
||||
minuet = {
|
||||
name = "minuet",
|
||||
module = "minuet.blink",
|
||||
async = true,
|
||||
timeout_ms = 3000,
|
||||
score_offset = 50,
|
||||
},
|
||||
},
|
||||
},
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||
})
|
||||
|
||||
local function minuet_blink_map()
|
||||
local ok, map = pcall(require("minuet").make_blink_map)
|
||||
if ok then
|
||||
return map()[1]
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set("i", "<A-y>", minuet_blink_map, { desc = "Minuet manual completion" })
|
||||
|
||||
@@ -17,6 +17,7 @@ vim.api.nvim_create_autocmd("PackChanged", {
|
||||
require("plugins.theme")
|
||||
require("plugins.mini-icons")
|
||||
require("plugins.treesitter")
|
||||
require("plugins.minuet")
|
||||
require("plugins.blink")
|
||||
require("plugins.whichkey")
|
||||
require("plugins.lualine")
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
vim.pack.add({
|
||||
{ src = "https://github.com/milanglacier/minuet-ai.nvim" },
|
||||
})
|
||||
|
||||
local function opencode_go_api_key()
|
||||
local ok, lines = pcall(vim.fn.readfile, vim.fn.expand("~/.local/share/opencode/auth.json"))
|
||||
if not ok then
|
||||
return nil
|
||||
end
|
||||
local ok_decode, auth = pcall(vim.fn.json_decode, table.concat(lines, "\n"))
|
||||
if not ok_decode or not auth["opencode-go"] or not auth["opencode-go"].key then
|
||||
return nil
|
||||
end
|
||||
return auth["opencode-go"].key
|
||||
end
|
||||
|
||||
local function setup_minuet()
|
||||
pcall(require("minuet").setup, {
|
||||
provider = "openai_compatible",
|
||||
request_timeout = 2.5,
|
||||
throttle = 1500,
|
||||
debounce = 600,
|
||||
provider_options = {
|
||||
openai_compatible = {
|
||||
api_key = opencode_go_api_key,
|
||||
end_point = "https://opencode.ai/zen/go/v1/chat/completions",
|
||||
model = "deepseek-v4-flash",
|
||||
name = "Opencode",
|
||||
optional = {
|
||||
max_tokens = 56,
|
||||
top_p = 0.9,
|
||||
thinking = { type = "disabled" },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
setup_minuet()
|
||||
|
||||
vim.api.nvim_create_autocmd("PackChanged", {
|
||||
callback = function(ev)
|
||||
if ev.data.spec.name == "minuet-ai.nvim" then
|
||||
setup_minuet()
|
||||
end
|
||||
end,
|
||||
})
|
||||
Reference in New Issue
Block a user