I'm trying to modify the keymaps of vim-cmp on my Lazy Vim install.
I've tried both methods in the following code, one of them is commented out:
return {
"hrsh7th/nvim-cmp",
opts = function(_, opts)
local cmp = require("cmp")
-- Add Ctrl+Shift+j and Ctrl+Shift+k mappings
-- opts.mapping["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert })
-- opts.mapping["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
-- opts.mapping = vim.tbl_extend("force", opts.mapping, {
-- ["<C-j>"] = cmp.mapping.select_next_item(),
-- ["<C-k>"] = cmp.mapping.select_prev_item(),
-- })
opts.mapping = cmp.mapping.preset.insert({
-- Select the [n]ext item
-- ['<C-n>'] = cmp.mapping.select_next_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
-- Select the [p]revious item
["<C-k>"] = cmp.mapping.select_prev_item(),
-- ['<C-p>'] = cmp.mapping.select_prev_item(),
})
return opts
end,
}
please help