From 652326e5f4e0b534350a10a11cb4e0a4de010c88 Mon Sep 17 00:00:00 2001 From: Bryan Ramos Date: Fri, 2 Jun 2023 10:26:33 -0400 Subject: [PATCH] Working pretty good, use this. Formatted a bit --- .../dotfiles/nvim/lua/config/autocmds.lua | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/homeConfig/dotfiles/nvim/lua/config/autocmds.lua b/homeConfig/dotfiles/nvim/lua/config/autocmds.lua index 8939cb1..a65251c 100644 --- a/homeConfig/dotfiles/nvim/lua/config/autocmds.lua +++ b/homeConfig/dotfiles/nvim/lua/config/autocmds.lua @@ -69,27 +69,7 @@ cmp.setup({ return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment") end end, - mapping = { - -- [""] = cmp.mapping(function(fallback) - -- if vim.fn.pumvisible() == 1 then - -- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("", true, true, true), "n") - -- elseif luasnip.expand_or_jumpable() then - -- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") - -- else - -- fallback() - -- end - -- end, { "i", "s" }), - - -- [""] = cmp.mapping(function(fallback) - -- if vim.fn.pumvisible() == 1 then - -- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("", true, true, true), "n") - -- elseif luasnip.jumpable(-1) then - -- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") - -- else - -- fallback() - -- end - -- end, { "i", "s" }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() @@ -113,6 +93,7 @@ cmp.setup({ fallback() end end, { "i", "s" }), + [""] = cmp.mapping({ i = function(fallback) if cmp.visible() and cmp.get_active_entry() then @@ -124,6 +105,26 @@ cmp.setup({ s = cmp.mapping.confirm({ select = true }), c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), }), + -- Lazyvim default + -- [""] = cmp.mapping(function(fallback) + -- if vim.fn.pumvisible() == 1 then + -- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("", true, true, true), "n") + -- elseif luasnip.expand_or_jumpable() then + -- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") + -- else + -- fallback() + -- end + -- end, { "i", "s" }), + + -- [""] = cmp.mapping(function(fallback) + -- if vim.fn.pumvisible() == 1 then + -- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("", true, true, true), "n") + -- elseif luasnip.jumpable(-1) then + -- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") + -- else + -- fallback() + -- end + -- end, { "i", "s" }), }, })