expr
mapping + choice gives an error
#429
Answered
by
L3MON4D3
kraftwerk28
asked this question in
Q&A
-
The following mapping results in
vim.keymap.set({"s", "i"}, "<C-;>", function()
if ls.choice_active() then
ls.change_choice(1)
else
return "<C-;>"
end
end, { silent = true, expr = true }) |
Beta Was this translation helpful? Give feedback.
Answered by
L3MON4D3
May 12, 2022
Replies: 1 comment 2 replies
-
Yeah, I think there are some restrictions on which functions you're allowed to call with imap <silent><expr> <C-E> luasnip#choice_active() ? '<Plug>luasnip-next-choice' : '<C-E>'
smap <silent><expr> <C-E> luasnip#choice_active() ? '<Plug>luasnip-next-choice' : '<C-E>'
imap <silent><expr> <C-T> luasnip#choice_active() ? '<Plug>luasnip-prev-choice' : '<C-T>'
smap <silent><expr> <C-T> luasnip#choice_active() ? '<Plug>luasnip-prev-choice' : '<C-T>' (Something along those lines should work.) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
kraftwerk28
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah, I think there are some restrictions on which functions you're allowed to call with
expr=true
, and we call those :|You can still map it via vimscript though:
(Something along those lines should work.)