return { "hrsh7th/nvim-cmp", dependencies = { "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lua", "hrsh7th/cmp-path", "hrsh7th/cmp-cmdline", "hrsh7th/cmp-buffer", "onsails/lspkind.nvim", -- Pictograms }, config = function() local cmp = require("cmp") vim.cmd("highlight FloatBorder guibg=NONE") cmp.setup({ completion = { completeopt = "menu,menuone,noinsert", }, snippet = { expand = function(args) vim.snippet.expand(args.body) end, }, window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), [""] = cmp.mapping.abort(), [""] = cmp.mapping.confirm({ select = true }), [""] = function() if cmp.visible_docs() then cmp.close_docs() else cmp.open_docs() end end, }), sources = cmp.config.sources({ { name = "nvim_lsp" }, { name = "path" }, { name = "buffer" }, }), formatting = { format = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = { -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) -- can also be a function to dynamically calculate max width such as -- menu = function() return math.floor(0.45 * vim.o.columns) end, menu = 50, -- leading text (labelDetails) abbr = 50, -- actual suggestion item }, }), }, }) end, }