Cycle through snippets #960
Replies: 3 comments 7 replies
-
You'll want to search on Luasnip for this, we're just calling into their API to jump to the next placeholder |
Beta Was this translation helpful? Give feedback.
-
@augustocdias May I ask how you navigate the placeholders? I don't even know how I can navigate the placeholders (using LazyVim) Tried something like this: keymap = {
['<Tab>'] = {
function(cmp)
if cmp.snippet_active() then
return cmp.accept()
else
return cmp.select_and_accept()
end
end,
'snippet_forward',
'fallback',
},
['<S-Tab>'] = { 'snippet_backward', 'fallback' }, And I tried something like this as well: keymap = {
['C-j'] = { 'snippet_forward', 'fallback' },
['C-k'] = { 'snippet_backward', 'fallback' },
} But that doesn't work at all |
Beta Was this translation helpful? Give feedback.
-
Are you able to complete into hidden snippets? For example some regex snippets don't really make sense to be shown. I have the following mapping right now: ['<Tab>'] = { 'select_next',
-- function(cmp)
-- if cmp.snippet_active() and require("luasnip").expandable() then
-- require("luasnip").expand()
-- end
-- end,
'snippet_forward', 'fallback' }, but the commented function currently doesn't work (looks like it might be a LuaSnip issue so I've made an issue there - it's to check if there's an expandable snippet that e.g. might be hidden. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm not sure if this is an issue I should open on LuaSnippets or here, but here we go. Is it possible to make the
snippet_forward
andsnippet_backward
to cycle when they reach the last (and I call forward) or first (and I call previous)? The current behavior I'm seeing is that it just goes to the fallback call when I reach one of the edges of the snippets.Beta Was this translation helpful? Give feedback.
All reactions