Trying to disable autocomplete in comments

This commit is contained in:
Bryan Ramos 2023-06-02 10:23:44 -04:00
parent a8f736ba3a
commit a221b0e725

View file

@ -59,6 +59,17 @@ end
local luasnip = require("luasnip") local luasnip = require("luasnip")
cmp.setup({ cmp.setup({
enabled = function()
-- disable completion in comments
local context = require("cmp.config.context")
-- keep command mode completion enabled when cursor is in a comment
if vim.api.nvim_get_mode().mode == "c" then
return true
else
return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment")
end
end,
mapping = { mapping = {
-- ["<Tab>"] = cmp.mapping(function(fallback) -- ["<Tab>"] = cmp.mapping(function(fallback)
-- if vim.fn.pumvisible() == 1 then -- if vim.fn.pumvisible() == 1 then
@ -79,7 +90,6 @@ cmp.setup({
-- fallback() -- fallback()
-- end -- end
-- end, { "i", "s" }), -- end, { "i", "s" }),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()