From 9150964742887b327e436b462ded3def0c210d32 Mon Sep 17 00:00:00 2001 From: Oliver Hartmann Date: Sat, 17 Jun 2023 22:20:08 +0200 Subject: [PATCH] fixed cmp tab --- lua/plugins/cmp.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 7b980bf..624f86d 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -51,7 +51,9 @@ return { s = cmp.mapping.confirm({ select = false }), }), [''] = cmp.mapping(function(fallback) - if luasnip.expand_or_jumpable() then + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then vim.api.nvim_feedkeys(t('luasnip-expand-or-jump'), '', true) else fallback() @@ -61,7 +63,9 @@ return { 's', }), [''] = cmp.mapping(function(fallback) - if luasnip.jumpable(-1) then + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then vim.api.nvim_feedkeys(t('luasnip-jump-prev'), '', true) else fallback()