return { { "L3MON4D3/LuaSnip", build = (not jit.os:find("Windows")) and "echo -e 'NOTE: jsregexp is optional, so not a big deal if it fails to build\n'; make install_jsregexp" or nil, dependencies = { "rafamadriz/friendly-snippets", config = function() require("luasnip.loaders.from_vscode").lazy_load() end, }, opts = { history = true, delete_check_events = "TextChanged", updateevents = "TextChanged,TextChangedI", enable_autosnippets = true, }, keys = function() return {} end, config = function(_, opts) require("luasnip").setup(opts) end, }, { "hrsh7th/nvim-cmp", event = "InsertEnter", dependencies = { "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", "saadparwaiz1/cmp_luasnip", { "roobert/tailwindcss-colorizer-cmp.nvim", config = true }, }, opts = function() local cmp = require("cmp") local luasnip = require("luasnip") return { preselect = cmp.PreselectMode.None, completion = { -- completeopt = "menu,menuone,noinsert", }, snippet = { expand = function(args) luasnip.lsp_expand(args.body) end, }, mapping = { [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), [""] = cmp.mapping.abort(), [""] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. [""] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false, }), -- Accept cur [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() else fallback() end end, { "i", "s" }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() else fallback() end end, { "i", "s", }), [""] = cmp.mapping(function(fallback) if luasnip.expandable() then luasnip.expand() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() else fallback() end end, { "i", "s", }), [""] = cmp.mapping(function(fallback) if luasnip.expand_or_jumpable(-1) then luasnip.jump(-1) else fallback() end end, { "i", "s", }), }, sources = cmp.config.sources({ { name = "nvim_lsp" }, { name = "luasnip" }, { name = "buffer" }, { name = "path" }, }), formatting = { format = function(entry, item) local icons = require("lazyvim.config").icons.kinds if icons[item.kind] then item.kind = icons[item.kind] .. item.kind end return require("tailwindcss-colorizer-cmp").formatter(entry, item) end, }, experimental = { ghost_text = { hl_group = "LspCodeLens", }, }, } end, config = function(_, opts) local cmp = require("cmp") require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" }) cmp.setup(opts) end, }, }