Cannot disable <C-n> <C-p> <C-e> bindings #2010
-
My bindings are being overwritten by nvim cmp. Below is my full configuration. I'm able to add additional mappings and change other cmp settings, but I can't figure out how to disable default keybindings. local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = {
["<C-n>"] = cmp.config.disable,
["<C-p>"] = cmp.config.disable,
["<C-e>"] = cmp.config.disable,
['<Tab>'] = cmp.mapping.confirm({ select = true }),
},
window = {
completion = cmp.config.window.bordered(),
},
performance = {
debounce = 60,
throttle = 30,
fetching_timeout = 200,
max_view_entries = 3,
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" }, -- For luasnip users.
}, {
{ name = "buffer" },
}),
})
vim.api.nvim_set_keymap('i', '<C-n>', '<Down>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('i', '<C-p>', '<Up>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('i', '<C-e>', '<ESC>A', {noremap = true, silent = true}) If I change mappings to this below, it successfully unmaps each binding about half of the time I open nvim. mapping = {
["<C-n>"] = {
c = cmp.config.disable,
},
["<C-p>"] = {
c = cmp.config.disable,
},
["<C-e>"] = {
c = cmp.config.disable,
},
['<Tab>'] = cmp.mapping.confirm({ select = true }),
}, Form previous discussions, I've seen people advise to rebind each command for each key you disable, but this does not fix it. I'm able to use my extra bindings, but the original bindings I want to disable are still enabled. I've tried this with the above variation specifying c = "" also. mapping = {
['<C-x><C-p>'] = cmp.mapping.scroll_docs(-4),
['<C-x><C-n>'] = cmp.mapping.scroll_docs(4),
['<C-x><C-e>'] = cmp.mapping.abort(),
["<C-n>"] = cmp.config.disable,
["<C-p>"] = cmp.config.disable,
["<C-e>"] = cmp.config.disable,
['<Tab>'] = cmp.mapping.confirm({ select = true }),
}, I'm at a total loss of what to do and have considered changing my bindings in place of nvim cmp's, which would work but I like my current setup. Any help would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I fixed it by disabling lsp zero and configuring the lsp without it. Lsp zero has its own configuration of nvim cmp which messed with mine. |
Beta Was this translation helpful? Give feedback.
I fixed it by disabling lsp zero and configuring the lsp without it. Lsp zero has its own configuration of nvim cmp which messed with mine.