From d1224ac34ad67d05bf5e24fd2a18fc77e2deb00c Mon Sep 17 00:00:00 2001 From: Darius Auding <Darius.auding@gmx.de> Date: Sun, 16 Jul 2023 23:21:10 +0200 Subject: [PATCH] small use of functions for better readability --- lua/codecraft/plugin/lsp/completion.lua | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/lua/codecraft/plugin/lsp/completion.lua b/lua/codecraft/plugin/lsp/completion.lua index 2c2b711..69260a7 100644 --- a/lua/codecraft/plugin/lsp/completion.lua +++ b/lua/codecraft/plugin/lsp/completion.lua @@ -16,24 +16,8 @@ cmp.setup({ behavior = cmp.ConfirmBehavior.Replace, select = true, }), - ["<Tab>"] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { "i", "s" }), - ["<S-Tab>"] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), + ["<S-TAB>"] = cmp.mapping.select_prev_item(), + ["<TAB>"] = cmp.mapping.select_next_item(), }), sources = { { name = "nvim_lsp" }, -- GitLab