return { { "L3MON4D3/LuaSnip" }, { "hrsh7th/nvim-cmp", dependencies = { "hrsh7th/cmp-buffer", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-path", "L3MON4D3/LuaSnip", }, opts = function() local cmp = require("cmp") return { snippet = { expand = function(args) require("luasnip").lsp_expand(args.body) end, }, mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), [""] = cmp.mapping(function(fallback) -- Confirm with C-Space. If none selected, confirm first. if cmp.visible() then local entry = cmp.get_selected_entry() if not entry then cmp.select_next_item({ behaviour = cmp.SelectBehavior.Select }) end cmp.confirm() else fallback() end end, { "i", "s", "c" }), }), sources = cmp.config.sources({ { name = "nvim_lsp" }, { name = "path" }, { name = "buffer" }, }), } end, }, }