return { "hrsh7th/nvim-cmp", config = function() require("plugins.cmp") end, dependencies = { "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-vsnip", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", "hrsh7th/cmp-nvim-lsp-signature-help", "onsails/lspkind.nvim", }, opts = function() vim.opt.completeopt = { "menuone", "noselect" } local cmp = require("cmp") local neogen = require("neogen") local lspkind = require("lspkind") cmp.setup({ snippet = { expand = function(args) vim.fn["vsnip#anonymous"](args.body) end, }, mapping = { -- [''] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), -- [''] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), [""] = cmp.mapping.select_next_item(), [""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping.complete(), [""] = cmp.mapping.close(), [""] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false, }), [""] = cmp.mapping(function(fallback) if neogen.jumpable() then neogen.jump_next() else fallback() end end, { "i", "s", }), [""] = cmp.mapping(function(fallback) if neogen.jumpable(true) then neogen.jump_prev() else fallback() end end, { "i", "s", }), }, sources = { { name = "nvim_lsp" }, { name = "nvim_lsp_signature_help" }, { name = "path" }, { name = "buffer", keyword_length = 5 }, { name = "vsnip" }, { name = "orgmode" }, }, formatting = { format = lspkind.cmp_format({ mode = "symbol", maxwidth = 50, ellipsis_char = "...", }), }, }) end, }