I'd like to use cmp-buffer as a completion source for nvim-cmp, but only when I explicitly request completion via <C-n>/<C-p>.
I've hacked this together locally:
- I created a new
nvim-cmp source that wraps cmp-buffer. The only difference is that my complete method doesn't do anything if params.context:get_reason() == types.cmp.ContextReason.Manual.
- I added
<C-n>/<C-p> mappings to invoke require("cmp").complete.
I'd like to use
cmp-bufferas a completion source fornvim-cmp, but only when I explicitly request completion via<C-n>/<C-p>.I've hacked this together locally:
nvim-cmpsource that wrapscmp-buffer. The only difference is that mycompletemethod doesn't do anything ifparams.context:get_reason() == types.cmp.ContextReason.Manual.nvim-cmpasking about this: Create a source which is only available when completion is manually triggered? nvim-cmp#803. AFAICT, there isn't a better way to do this right now other than creating a "wrapper source".<C-n>/<C-p>mappings to invokerequire("cmp").complete.nvim-cmpto look for completions from all sources. Ideally this would only triggercmp-buffer. I don't see any mechanism to filter sources when invokingcomplete, the code seems to just unconditionally loop over all sources.