How can I get cmp.complete()
in nvim-cmp
to start from the last entry. This is default behavior in vim. I want nvim-cmp
to open on pressing <C-p>
and start from the end of completion list, if its open then select previous entry. <C-n>
works similarly, it was easy to get that working. I want it to match the behavior that vim's default completion has. I use select_prev_item()
twice for now to go to last entry. Thats hacky and slow. I tried this too, but here I want cmp.complete()
to select last entry on open:
["<C-p>"] = function()
if cmp.visible() then
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
else
cmp.complete({
config = {
reason = cmp.ContextReason.Auto,
view = { entries = { selection_order = "bottom_up" }
}
}
})
end
end,