Fix nvim-cmp keymap

This commit is contained in:
Daniel Patterson
2023-11-07 12:35:29 +00:00
parent b2cea8639c
commit 4e9cefd541

View File

@@ -17,11 +17,33 @@ return {
lazy = false, lazy = false,
}, },
{ {
"folke/flash.nvim", "folke/flash.nvim",
keys = { keys = {
{ "s", mode = { "n", "x", "o" }, false }, { "s", mode = { "n", "x", "o" }, false },
{ "S", mode = { "n", "x", "o" }, false }, { "S", mode = { "n", "x", "o" }, false },
}, },
},
{
"hrsh7th/nvim-cmp",
opts = function(_, opts)
local cmp = require("cmp")
opts.mapping["<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 }),
})
opts.mapping["<S-CR>"] = nil
opts.mapping["<Tab>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert })
opts.mapping["<S-Tab>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
opts.completion.completeopt = "menu,menuone,noselect"
opts.preselect = cmp.PreselectMode.None
end,
}, },
{ {
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",