Saving last triggered snippet in a Global Variable #728
Answered
by
L3MON4D3
ziontee113
asked this question in
Q&A
-
Hi, I'm currently using this mapping to trigger the last triggered LuaSnip snippet: vim.keymap.set("i", "<A-CR>", function()
if LAST_TRIGGERED_SNIPPET then
vim.api.nvim_input("<A-o>")
vim.schedule(function()
ls.snip_expand(LAST_TRIGGERED_SNIPPET)
end)
end
end, {}) and I put this line Is there a cleaner way to do this (without modifying LuaSnip's source code)? Thank you very much! |
Beta Was this translation helpful? Give feedback.
Answered by
L3MON4D3
Jan 18, 2023
Replies: 1 comment 1 reply
-
Yes! We support dot-repeat (via vim-repeat), but you can do the same programatically by calling |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ziontee113
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes! We support dot-repeat (via vim-repeat), but you can do the same programatically by calling
ls.expand_repeat()
, which will expand the last-expanded snippet at your new cursor-position.