Imporve luasnip Tab jump behaviour

This commit is contained in:
socialsmoker223 2022-03-04 07:53:40 +08:00 committed by siduck
parent ef6ecab861
commit 1278a3b703

View File

@ -37,7 +37,7 @@ local default = {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
["<Tab>"] = function(fallback)
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
@ -45,8 +45,8 @@ local default = {
else
fallback()
end
end,
["<S-Tab>"] = function(fallback)
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
@ -54,7 +54,7 @@ local default = {
else
fallback()
end
end,
end, { "i", "s" }),
},
sources = {
{ name = "nvim_lsp" },