diff --git a/homeConfig/dotfiles/nvim/lua/config/autocmds.lua b/homeConfig/dotfiles/nvim/lua/config/autocmds.lua index fc2e4d4..8939cb1 100644 --- a/homeConfig/dotfiles/nvim/lua/config/autocmds.lua +++ b/homeConfig/dotfiles/nvim/lua/config/autocmds.lua @@ -59,6 +59,17 @@ end local luasnip = require("luasnip") 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 = { -- [""] = cmp.mapping(function(fallback) -- if vim.fn.pumvisible() == 1 then @@ -79,7 +90,6 @@ cmp.setup({ -- fallback() -- end -- end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item()