-- Completion: minuet against a local Ollama, no cloud fallback. -- Agent: sidekick hosts my own agent CLI in a terminal split. local full = vim.g.profile == "full" local endpoint = vim.env.MINUET_ENDPOINT or "http://127.0.0.1:11434" local function allowed(buf) buf = buf or vim.api.nvim_get_current_buf() local name = vim.api.nvim_buf_get_name(buf) local base = vim.fs.basename(name) return not ( vim.b[buf].bigfile or vim.bo[buf].filetype == "gitcommit" or base:match("^%.env") or name:match("/secrets/") ) end local function agent(fn, opts) return function() require("sidekick.cli")[fn](vim.tbl_extend("force", { name = "agent" }, opts or {})) end end return { { "milanglacier/minuet-ai.nvim", cond = full, lazy = true, -- loaded by blink.cmp dependencies = { "nvim-lua/plenary.nvim" }, keys = { { "ta", "Minuet blink toggle", desc = "Toggle AI completion" }, }, opts = { provider = "openai_fim_compatible", n_completions = 1, context_window = 4096, throttle = 1000, debounce = 400, request_timeout = 3, enable_predicates = { function() return allowed() end, }, provider_options = { openai_fim_compatible = { name = "ollama", api_key = "TERM", -- Ollama needs no key; any set env var works end_point = endpoint .. "/v1/completions", model = "qwen2.5-coder:3b", optional = { max_tokens = 56, top_p = 0.9 }, -- default template: Ollama builds the FIM prompt itself from `prompt` + `suffix` }, }, }, }, { "folke/sidekick.nvim", cond = full, keys = { { "", function() require("sidekick.cli").focus() end, desc = "Focus agent", mode = { "n", "t", "i", "x" } }, { "aa", agent("toggle", { focus = true }), desc = "Toggle agent" }, { "as", function() require("sidekick.cli").select() end, desc = "Select CLI session" }, { "at", agent("send", { msg = "{this}" }), desc = "Send this", mode = { "n", "x" } }, { "af", agent("send", { msg = "{file}" }), desc = "Send file" }, { "av", agent("send", { msg = "{selection}" }), desc = "Send selection", mode = "x" }, { "ap", agent("prompt"), desc = "Pick prompt", mode = { "n", "x" } }, { "ad", function() require("sidekick.cli").close() end, desc = "Detach session" }, }, opts = { nes = { enabled = false }, -- needs Copilot cli = { watch = true, mux = { enabled = false }, win = { layout = "right", split = { width = 80 } }, tools = { agent = { cmd = vim.split(vim.env.NVIM_AGENT_CMD or "agent", " ", { trimempty = true }) }, }, prompts = { review = "Review the current git diff (run `git diff`) for bugs, risks and simplifications.", explain = "Explain {this}", fix = "Fix these diagnostics in {file}:\n{diagnostics}", tests = "Write tests for {this}", }, }, }, }, }