diff --git a/vim/lua/nvim_cmp_config.lua b/vim/lua/nvim_cmp_config.lua index 7bfa7cf..4ebc000 100644 --- a/vim/lua/nvim_cmp_config.lua +++ b/vim/lua/nvim_cmp_config.lua @@ -68,14 +68,26 @@ cmp.setup({ }), sorting = { comparators = { - cmp.config.compare.offset, cmp.config.compare.exact, + require("copilot_cmp.comparators").prioritize, + cmp.config.compare.offset, cmp.config.compare.score, cmp.config.compare.recently_used, - -- require("cmp-under-comparator").under, + cmp.config.compare.locality, cmp.config.compare.kind, + cmp.config.compare.sort_text, + cmp.config.compare.length, + cmp.config.compare.order, }, }, + -- https://github.com/hrsh7th/nvim-cmp/wiki/Advanced-techniques#disabling-completion-in-certain-contexts-such-as-comments + enabled = function() + local context = require("cmp.config.context") + if vim.api.nvim_get_mode().mode == "c" then + return true + end + return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment") + end, formatting = { fields = { "kind", "abbr", "menu" }, },