From 9746cb182f59b43e3d17ec044d1afd8ffb5b07da Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Thu, 10 Oct 2024 10:04:46 +0200 Subject: nvim: usable cmp mappings --- .config/nvim/lua/plugins/cmp.lua | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to '.config/nvim') diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua index 8e34264..097d413 100644 --- a/.config/nvim/lua/plugins/cmp.lua +++ b/.config/nvim/lua/plugins/cmp.lua @@ -73,25 +73,19 @@ return { end, }, mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.confirm({ + [""] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, - select = false, + select = true, }), [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() + if luasnip.locally_jumpable(1) then + luasnip.jump(1) else fallback() end end, { "i", "s" }), [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then + if luasnip.locally_jumpable(-1) then luasnip.jump(-1) else fallback() -- cgit v1.2.3-70-g09d2