local cmp = require("cmp") local luasnip = require("luasnip") cmp.setup({ snippet = { expand = function(args) require("luasnip").lsp_expand(args.body) end, }, mapping = { [""] = cmp.mapping(function(fallback) if cmp.visible() then if luasnip.expandable() then luasnip.expand() else cmp.confirm({ select = true, }) end else fallback() end end), [""] = cmp.mapping(function(fallback) if luasnip.locally_jumpable(1) then luasnip.jump(1) elseif cmp.visible() then cmp.select_next_item() else fallback() end end, { "i", "s" }), [""] = cmp.mapping(function(fallback) if luasnip.locally_jumpable(-1) then luasnip.jump(-1) elseif cmp.visible() then cmp.select_prev_item() else fallback() end end, { "i", "s" }), }, sources = cmp.config.sources({ { name = "nvim_lsp" }, { name = "luasnip" }, }, { { name = "buffer" }, { name = "path" }, }), })