Fix cmp mappings

This commit is contained in:
ViViDboarder 2022-04-21 13:03:22 -07:00
parent 6161750843
commit 6be2309fdc

View File

@ -19,9 +19,11 @@ function M.config_cmp()
{ name = "buffer" }, { name = "buffer" },
{ name = "spell" }, { name = "spell" },
}, },
mapping = { mapping = cmp.mapping.preset.insert({
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), -- Scroll docs with readline back - forward
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), ["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
-- Expand snippets with Tab
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if luasnip.expand_or_jumpable() then if luasnip.expand_or_jumpable() then
luasnip.expand_or_jump() luasnip.expand_or_jump()
@ -29,19 +31,17 @@ function M.config_cmp()
fallback() fallback()
end end
end), end),
-- Start and cycle completions with C-Space
["<C-Space>"] = cmp.mapping(function() ["<C-Space>"] = cmp.mapping(function()
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
else else
cmp.complete() cmp.complete()
end end
end, { "i", "c" }), end),
["<C-e>"] = cmp.mapping({ -- Confirm completion with Enter
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
["<CR>"] = cmp.mapping.confirm({ select = true }), ["<CR>"] = cmp.mapping.confirm({ select = true }),
}, }),
}) })
-- Add a plug mapping to use in C-Space binding -- Add a plug mapping to use in C-Space binding