Skip to content

Noob here! How to change key mappings for nvim-cmp #2832

Discussion options

You must be logged in to vote

Oh, I see! Thanks @siduck . So the final solution is:

  {
    "hrsh7th/nvim-cmp",
    opts = function()
      local cmp = require("cmp")
      local conf = require("nvchad.configs.cmp")

      local mymappings = {
        ["<Up>"] = cmp.mapping.select_prev_item(),
        ["<Down>"] = cmp.mapping.select_next_item(),
        ["<Tab>"] = cmp.mapping.confirm {
          behavior = cmp.ConfirmBehavior.Replace,
          select = true,
        },
      }
      conf.mapping = vim.tbl_deep_extend("force", conf.mapping, mymappings)
      return conf
    end,
  },

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@fabricetriboix
Comment options

@fabricetriboix
Comment options

@siduck
Comment options

@fabricetriboix
Comment options

Answer selected by fabricetriboix
@siduck
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants