Fix nvim-cmp keymap
This commit is contained in:
@@ -23,6 +23,28 @@ return {
|
|||||||
{ "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",
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
|
|||||||
Reference in New Issue
Block a user