diff --git a/nvim/lua/plugins/nvim-cmp.lua b/nvim/lua/plugins/nvim-cmp.lua index ce92738..ebe6601 100644 --- a/nvim/lua/plugins/nvim-cmp.lua +++ b/nvim/lua/plugins/nvim-cmp.lua @@ -22,9 +22,15 @@ cmp.setup({ { name = "calc" } }), mapping = { - [''] = cmp.mapping(cmp.mapping.complete(), - { 'i', 'c' }), - [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(cmp.mapping.complete(), + { "i", "c" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() and cmp.get_selected_entry() then + cmp.confirm() + else + fallback() + end + end, { "i", "s" }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item()