How to trigger expand on <C-n>?
9mm opened this issue · 4 comments
I like this plugin, but all other cmp
result items automatically load when cycling through the list with <C-n>
.
How can I make luasnip snippets do that as well so i dont have ot actually fully confirm them
Hi - what do you mean by automatically load?
When pressing <C-n>
with nvim-cmp, the item thats currently highlighted actually gets expanded underneath the cursor each press of <C-n>
, there's no need to actually "confirm" the item with tab/enter/whatever (at least according to my configuration of cmp)
The only one that doesnt follow this convention is cmp_luasnip, which requires a full confirmation.
It would be awesome if there was a setting that would expand the snippet with <C-n>
(or the default next snippet
key), and if you press <C-n>
again and go PAST the snippet in the list it would simply disappear again and expand the NEXT selection in the cmp list.
That's a bit out of the scope for this plugin. What we'd need is a way to undo a snippet expansion not sure if this is supported (tagging @L3MON4D3 incase he knows). Even if this was supported cmp
will need to trigger the undo.
So for now there's no "undo expansion" in luasnip, but it would be a nice addition.
I think the idea is pretty cool, but I don't think cmp has an un-execute-hook. There's resolve
(traditionally for displaying documentation, but we could use it for this), but there is no callback that is called when the item is "undisplayed" (except resolve on the next item, but that's not always us :/)
So, this would need some changes to cmp-core, which I think are rather unlikely :/