Skip to content

Question / recipe: How to use cmp-buffer as a replacement for Vim's builtin <C-n>/<C-p> keyword completion? #78

Description

@jfly

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:

  1. 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.
  2. I added <C-n>/<C-p> mappings to invoke require("cmp").complete.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions