disable cmp in comments

This commit is contained in:
Baipyrus 2024-04-22 07:57:15 +02:00
parent 6f6ee89316
commit 680e5f69c1

View File

@ -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)