mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 00:49:03 +02:00
fix(copilot): confirm with replace for copilot only
This commit is contained in:
parent
ae9c74d88e
commit
079d3967d0
1 changed files with 17 additions and 0 deletions
|
@ -35,7 +35,24 @@ return {
|
|||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
|
||||
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "copilot" } }))
|
||||
|
||||
local confirm = opts.mapping["<CR>"]
|
||||
local confirm_copilot = cmp.mapping.confirm({
|
||||
select = true,
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
})
|
||||
|
||||
opts.mapping = vim.tbl_extend("force", opts.mapping, {
|
||||
["<CR>"] = function(...)
|
||||
local entry = cmp.get_selected_entry()
|
||||
if entry and entry.source.name == "copilot" then
|
||||
return confirm_copilot(...)
|
||||
end
|
||||
return confirm(...)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue