Fixed no complete on < CR >

This commit is contained in:
Daveanand Mannie
2024-09-05 20:55:37 -04:00
parent 0b40e540c8
commit 660f9ec75a
2 changed files with 12 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
{
"LazyVim": { "branch": "main", "commit": "12818a6cb499456f4903c5d8e68af43753ebc869" },
"SchemaStore.nvim": { "branch": "main", "commit": "3436c0514e8c46162d0480c187e2cfcefecdffc6" },
"SchemaStore.nvim": { "branch": "main", "commit": "28a6a50e5b7b963dc6a5d2defc40e158231a67ed" },
"bufferline.nvim": { "branch": "main", "commit": "0b2fd861eee7595015b6561dade52fb060be10c4" },
"catppuccin": { "branch": "main", "commit": "4fd72a9ab64b393c2c22b168508fd244877fec96" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },

View File

@@ -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 })
["<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() -- Insert a new line if completion is not visible
fallback()
end
end, { "i", "s" }), -- 'i' for insert mode, 's' for select mode
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
}),
},
})