return { "hrsh7th/nvim-cmp", opts = function() vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) local cmp = require "cmp" local defaults = require "cmp.config.default"() return { enabled = function() local context = require "cmp.config.context" if vim.api.nvim_get_mode().mode == "c" then return true else return not context.in_treesitter_capture "comment" and not context.in_syntax_group "Comment" end end, completion = { completeopt = "menu,menuone,noinsert", }, snippet = { expand = function(args) require("luasnip").lsp_expand(args.body) end, }, window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, mapping = cmp.mapping.preset.insert { [""] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert }, [""] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert }, [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.abort(), [""] = cmp.mapping.confirm { select = false }, }, sources = cmp.config.sources { { name = "nvim_lsp" }, { name = "path" }, }, formatting = { format = function(_, item) local icons = require("icons").kinds if icons[item.kind] then item.kind = icons[item.kind] .. item.kind end return item end, }, experimental = { ghost_text = { hl_group = "CmpGhostText", }, }, sorting = defaults.sorting, } end, dependencies = { { "L3MON4D3/LuaSnip", build = "make install_jsregexp" }, "hrsh7th/cmp-path", "saadparwaiz1/cmp_luasnip", }, enabled = false, }