Fixed no complete on < CR >
This commit is contained in:
@@ -15,12 +15,16 @@ local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
mapping = {
|
||||
["<Tab>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<CR>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.confirm({ select = false })
|
||||
else
|
||||
fallback() -- Insert a new line if completion is not visible
|
||||
end
|
||||
end, { "i", "s" }), -- 'i' for insert mode, 's' for select mode
|
||||
["<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 }),
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user