fixed cmp CR behaviour at end of line

This commit is contained in:
Oliver Hartmann 2023-03-19 21:55:02 +01:00
parent 6e3a2f931c
commit 3e49aa40a5

View File

@ -51,7 +51,13 @@ return {
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c', 's' }),
['<C-e>'] = cmp.mapping(cmp.mapping.close(), { 'i', 'c', 's' }),
['<CR>'] = cmp.mapping({
i = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = false }),
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = false })
else
fallback()
end
end,
c = cmp.mapping.confirm({ select = false }),
s = cmp.mapping.confirm({ select = false }),
}),