fix issue with completions being autoselected by <CR> prior to tab being pressed
This commit is contained in:
parent
e81b79889b
commit
fef00508a3
@ -107,7 +107,17 @@ return {
|
|||||||
},
|
},
|
||||||
-- Accept currently selected item. If none selected, `select` first item.
|
-- Accept currently selected item. If none selected, `select` first item.
|
||||||
-- Set `select` to `false` to only confirm explicitly selected items.
|
-- Set `select` to `false` to only confirm explicitly selected items.
|
||||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
["<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()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
s = cmp.mapping.confirm({ select = false }),
|
||||||
|
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }),
|
||||||
|
}),
|
||||||
["<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()
|
||||||
@ -157,7 +167,8 @@ return {
|
|||||||
autocomplete = {
|
autocomplete = {
|
||||||
require('cmp.types').cmp.TriggerEvent.TextChanged,
|
require('cmp.types').cmp.TriggerEvent.TextChanged,
|
||||||
},
|
},
|
||||||
completeopt = 'menu,menuone,noselect',
|
|
||||||
|
completeopt = 'menu,menuone,noselect,noinsert,preview',
|
||||||
keyword_pattern = ".*",
|
keyword_pattern = ".*",
|
||||||
keyword_length = 1, -- Set to 1 for immediate as-you-type completion
|
keyword_length = 1, -- Set to 1 for immediate as-you-type completion
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user