ultisnips
ultisnips copied to clipboard
Issues with circulating between placeholders
I am using Neovim stable with nvim.cmp and cmp-nvim-ultisnips But noticed that the I am not able to circulate the snippet placeholders using tabs like it was working before. Its not even working in the neovim stable release. When I am typing in the snippet placeholder the autocompletes are popping up while I am typing. On completion I am not able to use the tabs to move to the next placeholder.
This working earlier before -few days back This is my mapping setup. I am sorry I am no expert on this. Just tried to follow some leads which I picked up while going through the configs of others and it worked for me till recently
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
["<C-Space>"] = cmp.mapping(function(fallback)
if vim.fn.pumvisible() == 1 then
if vim.fn["UltiSnips#CanExpandSnippet"]() == 1 then
return vim.fn.feedkeys(t("<C-R>=UltiSnips#ExpandSnippet()<CR>"))
end
vim.fn.feedkeys(t("<C-n>"), "n")
elseif check_back_space() then
vim.fn.feedkeys(t("<cr>"), "n")
else
fallback()
end
end, {
"i",
"s",
}),
["<Tab>"] = cmp.mapping(function(fallback)
if vim.fn.complete_info()["selected"] == -1 and vim.fn["UltiSnips#CanExpandSnippet"]() == 1 then
vim.fn.feedkeys(t("<C-R>=UltiSnips#ExpandSnippet()<CR>"))
elseif vim.fn["UltiSnips#CanJumpForwards"]() == 1 then
vim.fn.feedkeys(t("<ESC>:call UltiSnips#JumpForwards()<CR>"))
elseif vim.fn.pumvisible() == 1 then
vim.fn.feedkeys(t("<C-n>"), "n")
elseif check_back_space() then
vim.fn.feedkeys(t("<tab>"), "n")
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if vim.fn["UltiSnips#CanJumpBackwards"]() == 1 then
return vim.fn.feedkeys(t("<C-R>=UltiSnips#JumpBackwards()<CR>"))
elseif vim.fn.pumvisible() == 1 then
vim.fn.feedkeys(t("<C-p>"), "n")
else
fallback()
end
end, {
"i",
"s",
}),
},
My plugin setup
use({
"SirVer/ultisnips",
requires = { "honza/vim-snippets" },
config = function()
vim.g.UltiSnipsRemoveSelectModeMappings = 0
end,
})