fix(cmp): only complete on <cr> when cmp is really visible. Dont wait till it might be visible. Faster and more correct imho

This commit is contained in:
Folke Lemaitre
2024-05-19 09:58:28 +02:00
parent 4208a09df8
commit ad22adab7d

View File

@ -37,7 +37,7 @@ return {
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = function(fallback)
if cmp.visible() then
if cmp.core.view:visible() or vim.fn.pumvisible() == 1 then
LazyVim.create_undo()
if cmp.confirm({ select = true }) then
return