25 lines
758 B
Lua
25 lines
758 B
Lua
return {
|
|
"hrsh7th/nvim-cmp",
|
|
event = { "InsertEnter", "CmdlineEnter" },
|
|
opts = function(_, opts)
|
|
local cmp = require("cmp")
|
|
|
|
opts.mapping = vim.tbl_extend("force", opts.mapping, {
|
|
["<C-Space>"] = cmp.mapping.confirm({
|
|
behavior = cmp.ConfirmBehavior.Insert,
|
|
select = true,
|
|
}),
|
|
["<CR>"] = cmp.mapping({
|
|
i = function(fallback)
|
|
if cmp.visible() and cmp.get_active_entry() then
|
|
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
|
|
else
|
|
fallback()
|
|
end
|
|
end,
|
|
s = cmp.mapping.confirm({ select = true }),
|
|
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
|
}),
|
|
})
|
|
end,
|
|
}
|