feat: Updates nvim-cmp

This commit is contained in:
2024-11-21 21:21:28 -05:00
parent 0c15983dae
commit 1e427911ac

View File

@@ -32,19 +32,26 @@ return {
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion ["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion ["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions ["<C-Space>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}), -- select completion, this makes it so it doesn't auto complete when suggesting.
["<C-e>"] = cmp.mapping.abort(), -- close completion window ["<C-e>"] = cmp.mapping.abort(), -- close completion window
["<CR>"] = cmp.mapping(function(fallback) ["<CR>"] = cmp.mapping({
if cmp.visible() then i = function(fallback)
if luasnip.expandable() then if cmp.visible() then
luasnip.expand() if luasnip.expandable() then
luasnip.expand()
else
cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })
end
else else
cmp.confirm({ select = true }) fallback()
end end
else end,
fallback() s = cmp.mapping.confirm({ select = true }),
end c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
end), }),
-- TODO: -- TODO:
-- The next two mappings are also implemented in the LuaSnip configuration, -- The next two mappings are also implemented in the LuaSnip configuration,
-- as <C-j> and <C-k> do they actually need to be here?? -- as <C-j> and <C-k> do they actually need to be here??