You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to set up keymaps to toggle completion on and off, but I'm not sure how to check whether completion is currently enabled or disabled.
local cmp = require("cmp")
-- I can't figure out how to check whether completion is currently enabled
local cmpenabled = true
local cmpenabledbuffer = true
vim.keymap.set("n", "<leader>oc", function()
cmp.setup.buffer({ enabled = not cmpenabledbuffer })
end, { desc = "Toggle completion for buffer" })
vim.keymap.set("n", "<leader>oC", function()
cmp.setup({ enabled = not cmpenabled })
end, { desc = "Toggle completion globally" })
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to set up keymaps to toggle completion on and off, but I'm not sure how to check whether completion is currently enabled or disabled.
Beta Was this translation helpful? Give feedback.
All reactions