-- Tame blink.cmp completions for prose: -- * drop the `buffer` (next-word) source everywhere -- * markdown/md-render buffers use LSP+path only (no snippet callout noise) -- * disable friendly-snippets' global snippets (datetime/dateMDY/lorem/...) -- Inline LLM ghost-text (minuet-ai.nvim) was removed; blink is the only completion source. return { "saghen/blink.cmp", opts = function(_, opts) opts.sources = opts.sources or {} -- Drop the buffer (next-word) source everywhere. opts.sources.default = vim.tbl_filter(function(source) return source ~= "buffer" end, opts.sources.default or { "lsp", "path", "snippets" }) -- Markdown editing (ft=markdown) and md-render's render buffer (ft=md-render): -- LSP+path only, so callout snippets like !WARNING don't pop up. md-render -- flips the buffer filetype between these two as you edit, so cover both. opts.sources.per_filetype = opts.sources.per_filetype or {} opts.sources.per_filetype.markdown = { "lsp", "path" } opts.sources.per_filetype["md-render"] = { "lsp", "path" } -- Kill friendly-snippets' GLOBAL snippets (global.json: datetime, dateMDY, -- lorem, etc.). These load in every filetype regardless of the per_filetype -- rules above, which is why they leaked through while editing markdown. -- Per-language snippets (friendly_snippets) are unaffected. opts.sources.providers = opts.sources.providers or {} opts.sources.providers.snippets = opts.sources.providers.snippets or {} opts.sources.providers.snippets.opts = opts.sources.providers.snippets.opts or {} opts.sources.providers.snippets.opts.global_snippets = {} -- Global on/off switch for completion (uk below). While it's on, -- blink's own `enabled` check still applies. local prev = opts.enabled opts.enabled = function() if vim.g.thembones_completion == false then return false end if type(prev) == "function" then return prev() end return true end end, keys = { { "uk", function() vim.g.thembones_completion = vim.g.thembones_completion == false if not vim.g.thembones_completion then pcall(function() require("blink.cmp").hide() end) end vim.notify("Completion " .. (vim.g.thembones_completion and "on" or "off")) end, desc = "Toggle Completion (global)", }, }, }