diff options
Diffstat (limited to 'lua/ache')
| -rw-r--r-- | lua/ache/plugins/nvim-cmp.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lua/ache/plugins/nvim-cmp.lua b/lua/ache/plugins/nvim-cmp.lua index 5a63ab1..fc9ef0c 100644 --- a/lua/ache/plugins/nvim-cmp.lua +++ b/lua/ache/plugins/nvim-cmp.lua @@ -102,6 +102,26 @@ return { ["<c-space>"] = cmp.mapping.complete(), ["<c-e>"] = cmp.mapping.abort(), ["<CR>"] = cmp.mapping.confirm({ select = true }), + -- To add <Tab> and <S-Tab> in completion AND as luasnip edition move + ["<Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.locally_jumpable(1) then + luasnip.jump(1) + else + fallback() + end + end, { "i", "s" }), + + ["<S-Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), }), -- Order is important ! |