LazyVim uses blink.cmp as its completion engine. The suggestion popup is great while coding, but in a markdown buffer or when taking notes it tends to get in the way. A small override gives you Ctrl+Q as a clean per-buffer toggle.
How Plugins Work in LazyVim
Plugins in LazyVim run through lazy.nvim. Every Lua file under ~/.config/nvim/lua/plugins/ is a plugin spec. New plugins are installed through them, existing ones are reconfigured via opts or extended through a function. That way you split the config into small, focused building blocks instead of a single monolithic file.
Create the Override
Open a new file for the override directly in nvim:
nvim ~/.config/nvim/lua/plugins/blink-toggle.lua
Drop in the contents and save and quit with :wq:
return {
"saghen/blink.cmp",
opts = function(_, opts)
local completion_toggle = Snacks.toggle({
name = "Completion",
get = function()
return vim.b.completion
end,
set = function(state)
vim.b.completion = state
end,
})
local function toggle_completion()
require("blink.cmp").hide()
completion_toggle:toggle()
end
vim.keymap.set({ "i", "n" }, "<C-q>", toggle_completion, { desc = "Toggle Completion" })
opts.enabled = function()
return vim.b.completion
end
return opts
end,
}
What the Override Does
opts.enabled now depends on vim.b.completion, a buffer-local variable. State is tracked per buffer. Ctrl+Q toggles completion in the current buffer, in both insert and normal mode. Snacks.toggle makes sure the switch shows up as a named toggle in LazyVim.
Heads-up: in freshly opened buffers vim.b.completion isn’t set yet, so completion is off. One press of Ctrl+Q turns it on. If that doesn’t fit your workflow, an autocmd can default the variable to true.