Maintain `<c-e>` and `<c-y>` functionality in insert/select mode.

main
Joshua Potter 2024-01-04 16:02:10 -07:00
parent dd9a4b5493
commit 930607a63a
1 changed files with 16 additions and 20 deletions

View File

@ -33,26 +33,22 @@ function M.setup()
},
}
vim.keymap.set(
{ 'i', 's' },
'<c-e>',
function()
vim.keymap.set({ 'i', 's' }, '<c-e>', function()
if luasnip.choice_active() then
luasnip.change_choice(1)
return '<Plug>luasnip-next-choice'
else
return '<c-e>'
end
end,
{ silent = true }
)
vim.keymap.set(
{ 'i', 's' },
'<c-y>',
function()
end, { silent = true, expr = true, remap = true })
vim.keymap.set({ 'i', 's' }, '<c-y>', function()
if luasnip.choice_active() then
luasnip.change_choice(-1)
return '<Plug>luasnip-prev-choice'
else
return '<c-y>'
end
end,
{ silent = true }
)
end, { silent = true, expr = true, remap = true })
-- Allow aborting the active snippet at any point in time.
vim.keymap.set(
{ 'n', 'i', 's' },