Duplicate expansion
hinell opened this issue · 2 comments
hinell commented
Peek.2023-01-30.00-47.mp4
Having a weird duplicate expansion. Tab
keys aren't working for jumps.
--Approximate config
-- plugins-snippets.lua
local cmp = require("cmp")
cmp.setup({
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<C-S-j>"] = cmp.mapping(function(fallback)
if vim.fn["vsnip#jumpable"](1) == 1 then
feedkey("<Plug>(vsnip-jump-next")
else
fallback()
end
end, { "s" }),
["<Tab>"] = cmp.mapping(function(fallback)
-- elseif vim.fn["vsnip#available"](1) == 1 then
if vim.fn["vsnip#jumpable"](1) == 1 then
feedkey("<Plug>(vsnip-jump-next", "")
elseif cmp.visible() then
cmp.select_next_item()
elseif has_words_before() then
cmp.complete()
else
--The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function()
if vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
elseif cmp.visible() then
cmp.select_prev_item()
end
end, { "i", "s" }),
...
end -- setup end
Snippet:
"workspace doc open": {
"prefix": "doc.open.content",
"body": [
"workspace.openTextDocument({",
" content : ${1:\"File content\"},",
" language: \"${2|javascript,typescript,texmate.snippet|}\"",
"});"
],
"description": "Open vs code workspace document"
}
Version
- NVIM v0.9.0-dev-a0a1125
- nvim-cmp: e7e2ef7031db8e0cfad7ad9916ec766ddd9dbb3b
- cmp-vsnip: 989a8a7
- Packer.nvim
hinell commented
Closing this issue, cause the original problem may come from two consequent calls like:
...
cmp.confirm()
luasnip.expand()
Watch out your version!
hinell commented
See also related discussion hrsh7th/nvim-cmp#1447