Disable autocomplete in a comment block #122
-
Can anyone tell me which plugin is doing this so I may disable it? |
Beta Was this translation helpful? Give feedback.
Answered by
VonHeikemen
Jan 12, 2023
Replies: 1 comment 3 replies
-
The autocomplete plugin is nvim-cmp. If you are using the local lsp = require('lsp-zero')
lsp.preset('lsp-compe')
lsp.setup()
vim.opt.completeopt = {'menu', 'menuone', 'noselect'}
local cmp = require('cmp')
local cmp_enabled = cmp.get_config().enabled
local cmp_config = lsp.defaults.cmp_config({
enabled = function()
if require('cmp.config.context').in_treesitter_capture('comment') == true
or require('cmp.config.context').in_syntax_group('Comment')
then
return false
else
-- execute cmp's original function
return cmp_enabled()
end
end
})
cmp.setup(cmp_config) |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
twiclo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The autocomplete plugin is nvim-cmp.
If you are using the
recommended
preset then change it tolsp-compe
, then use this snippet.