Closed JoseConseco closed 3 years ago
Hi! I think there's a mistake in your code. It should be if vim.fn["snippy#can_jump"](-1) == 1 then
, or you could use the Lua version:
local snippy = require("snippy")
if snippy.can_jump(-1) then
...
Please let me know if it still isn't working for you.
As for the guide, there's currently none specifically for cmp, except for what is said in this project's readme, but I'll see if can come up with something specific for Lua and/or cmp.
thanks, the fix worked ok. Now I hit another problem where cmp can correctly detect if selected entry is snippy snippet:
if cmp.visible() then
if cmp.core.view:get_selected_entry() then
if vim.fn["snippy#can_expand"]() == 1 then
print('can jum')
return vim.fn.feedkeys(t("<C-R>=<Plug>(snippy-expand-or-next)<CR>"))
else
print('cannot')
vim.fn.feedkeys(t("<cr>"), "n")
end
else
vim.fn.feedkeys(t("<C-e>"), "n")
end
else
cmp.complete() -- invoke popup
end
vim.fn["snippy#can_expand"]() - does not seem to correctly detect that selected item in cmp popup is snippy item.. For now I will wait until there is more online help, before jumping into snippy. Plugins is great and I hope it will get more people attention soon!
Hi when I try to map tab to jump next like so:
if vim.fn["snippy#can_jump(-1)"]() == 1 then
I get error: Is there guide how to map nvim cmp for snippy with tab(tab) and shift tab (prev)?