feat: only confirm autocomplete with enter if item selected
This commit is contained in:
parent
fde2607ca2
commit
415fcc08ae
@ -22,9 +22,15 @@ cmp.setup({
|
|||||||
{ name = "calc" }
|
{ name = "calc" }
|
||||||
}),
|
}),
|
||||||
mapping = {
|
mapping = {
|
||||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(),
|
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(),
|
||||||
{ 'i', 'c' }),
|
{ "i", "c" }),
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
["<CR>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() and cmp.get_selected_entry() then
|
||||||
|
cmp.confirm()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
|
Reference in New Issue
Block a user