Working pretty good, use this. Formatted a bit

This commit is contained in:
Bryan Ramos 2023-06-02 10:26:33 -04:00
parent a221b0e725
commit 652326e5f4

View file

@ -69,27 +69,7 @@ cmp.setup({
return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment") return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment")
end end
end, end,
mapping = { mapping = {
-- ["<Tab>"] = cmp.mapping(function(fallback)
-- if vim.fn.pumvisible() == 1 then
-- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-y>", true, true, true), "n")
-- elseif luasnip.expand_or_jumpable() then
-- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
-- else
-- fallback()
-- end
-- end, { "i", "s" }),
-- ["<S-Tab>"] = cmp.mapping(function(fallback)
-- if vim.fn.pumvisible() == 1 then
-- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-p>", true, true, true), "n")
-- elseif luasnip.jumpable(-1) then
-- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
-- else
-- fallback()
-- end
-- end, { "i", "s" }),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
@ -113,6 +93,7 @@ cmp.setup({
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
["<CR>"] = cmp.mapping({ ["<CR>"] = cmp.mapping({
i = function(fallback) i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then if cmp.visible() and cmp.get_active_entry() then
@ -124,6 +105,26 @@ cmp.setup({
s = cmp.mapping.confirm({ select = true }), s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
}), }),
-- Lazyvim default
-- ["<Tab>"] = cmp.mapping(function(fallback)
-- if vim.fn.pumvisible() == 1 then
-- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-y>", true, true, true), "n")
-- elseif luasnip.expand_or_jumpable() then
-- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
-- else
-- fallback()
-- end
-- end, { "i", "s" }),
-- ["<S-Tab>"] = cmp.mapping(function(fallback)
-- if vim.fn.pumvisible() == 1 then
-- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-p>", true, true, true), "n")
-- elseif luasnip.jumpable(-1) then
-- vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
-- else
-- fallback()
-- end
-- end, { "i", "s" }),
}, },
}) })