diff --git a/lua/kickstart/plugins/cmp.lua b/lua/kickstart/plugins/cmp.lua index d2050f3..6c1f3cb 100644 --- a/lua/kickstart/plugins/cmp.lua +++ b/lua/kickstart/plugins/cmp.lua @@ -38,6 +38,16 @@ return { luasnip.config.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, snippet = { expand = function(args) luasnip.lsp_expand(args.body)