mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-28 05:54:03 +02:00
feature: allow cmp confirm options to be configurable (#1523)
This commit is contained in:
parent
279d537e9c
commit
fbfd8c1fc3
1 changed files with 13 additions and 4 deletions
|
@ -30,6 +30,10 @@ M.config = function()
|
|||
return
|
||||
end
|
||||
lvim.builtin.cmp = {
|
||||
confirm_opts = {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
local icons = require("lsp.kind").icons
|
||||
|
@ -107,10 +111,15 @@ M.config = function()
|
|||
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
["<CR>"] = cmp.mapping(function(fallback)
|
||||
if not require("cmp").confirm(lvim.builtin.cmp.confirm_opts) then
|
||||
if luasnip.jumpable() then
|
||||
vim.fn.feedkeys(T "<Plug>luasnip-jump-next", "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
end),
|
||||
},
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue