Skip to content

Advanced techniques

Zoltán Reegn edited this page Jan 12, 2022 · 15 revisions

This page contains advanced techniques.

Managing completion timing completely

nvim-cmp has the Programatic API. So you can manage the completion behavior by yourself.

See https://github.com/hrsh7th/nvim-cmp/issues/519#issuecomment-969674104

Disabling completion in certain contexts, such as comments

See https://github.com/hrsh7th/nvim-cmp/pull/676#issuecomment-1002532096

cmd.setup({
    enabled = function()
      -- disable completion in comments
      local context = require 'cmp.config.context'
      return not context.in_treesitter_capture("comment") 
        and not context.in_syntax_group("Comment")
})
Clone this wiki locally