diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua index a17cf5b..57ab2d5 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -39,6 +39,7 @@ return { config = function() -- See `:help cmp` local cmp = require 'cmp' + local types = require 'cmp.types' local luasnip = require 'luasnip' luasnip.config.setup {} @@ -55,6 +56,15 @@ return { -- -- No, but seriously. Please read `:help ins-completion`, it is really good! mapping = cmp.mapping.preset.insert { + -- Disable use of and for navigation within a completion list. + [''] = cmp.mapping.close(), + [''] = cmp.mapping.close(), + + -- Identical to old key behavior + [''] = cmp.mapping.select_next_item { behavior = types.cmp.SelectBehavior.Select }, + -- Identical to old key behavior + [''] = cmp.mapping.select_prev_item { behavior = types.cmp.SelectBehavior.Select }, + -- Select the [n]ext item [''] = cmp.mapping.select_next_item(), -- Select the [p]revious item @@ -69,7 +79,8 @@ return { -- This will expand snippets if the LSP sent a snippet. [''] = cmp.mapping.confirm { select = true }, - [''] = cmp.mapping.close(), + -- Cancel/abort any selected/partial completion and close the completion list. + [''] = cmp.mapping.abort(), -- If you prefer more traditional completion keymaps, -- you can uncomment the following lines