diff --git a/users/jrpotter/neovim/config/utils/luasnip.lua b/users/jrpotter/neovim/config/utils/luasnip.lua index ef3ad69..0b58327 100644 --- a/users/jrpotter/neovim/config/utils/luasnip.lua +++ b/users/jrpotter/neovim/config/utils/luasnip.lua @@ -33,26 +33,22 @@ function M.setup() }, } - vim.keymap.set( - { 'i', 's' }, - '', - function() - if luasnip.choice_active() then - luasnip.change_choice(1) - end - end, - { silent = true } - ) - vim.keymap.set( - { 'i', 's' }, - '', - function() - if luasnip.choice_active() then - luasnip.change_choice(-1) - end - end, - { silent = true } - ) + vim.keymap.set({ 'i', 's' }, '', function() + if luasnip.choice_active() then + return 'luasnip-next-choice' + else + return '' + end + end, { silent = true, expr = true, remap = true }) + + vim.keymap.set({ 'i', 's' }, '', function() + if luasnip.choice_active() then + return 'luasnip-prev-choice' + else + return '' + end + end, { silent = true, expr = true, remap = true }) + -- Allow aborting the active snippet at any point in time. vim.keymap.set( { 'n', 'i', 's' },