local cmp = require("cmp") local luasnip = require("luasnip") luasnip.setup { update_events = { "TextChanged", "TextChangedI" } } cmp.setup { snippet = { expand = function(args) luasnip.lsp_expand(args.body) end, }, mapping = cmp.mapping.preset.insert { [""] = cmp.mapping(function(fallback) if luasnip.locally_jumpable(1) then luasnip.jump(1) else fallback() end end, { "i", "s" }), [""] = cmp.mapping(function(fallback) if luasnip.locally_jumpable(-1) then luasnip.jump(-1) else fallback() end end, { "i", "s" }), }, sources = cmp.config.sources({ { name = "luasnip" }, { name = "nvim_lsp" }, { name = "path" }, }, { { name = "buffer" }, { name = "spell" }, }), }