Skip to content

Commit

Permalink
Imporve luasnip Tab jump behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
socialsmoker223 authored and siduck committed Mar 7, 2022
1 parent ef6ecab commit 1278a3b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lua/plugins/configs/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ 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
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
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
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else
fallback()
end
end,
end, { "i", "s" }),
},
sources = {
{ name = "nvim_lsp" },
Expand Down

0 comments on commit 1278a3b

Please sign in to comment.