return {
  "saghen/blink.cmp",
  ---@param opts blink.cmp.Config
  opts = function(_, opts)
    -- Start with completion disabled in the current buffer.
    -- Remove this line if you want it enabled by default.
    vim.b.completion = false

    -- Toggle completion per-buffer with <leader>uk
    Snacks.toggle({
      name = "Completion",
      get = function()
        -- treat anything except explicit false as "on"
        return vim.b.completion ~= false
      end,
      set = function(state)
        vim.b.completion = state
      end,
    }):map("<leader>uk")

    -- Override Blink's global enabled() logic
    opts.enabled = function()
      -- 1) Hard-disable completion for markdown buffers
      if vim.bo.filetype == "markdown" or vim.bo.filetype == "markdown.mdx" then
        return false
      end

      -- 2) Keep Blink's default "no completion in prompt buffers"
      if vim.bo.buftype == "prompt" then
        return false
      end

      -- 3) Respect the per-buffer toggle
      return vim.b.completion ~= false
    end

    return opts
  end,
}
