From 64361c386bb2408ee6274b4d1827c6f8b30442f3 Mon Sep 17 00:00:00 2001 From: Luna Komorebi Date: Wed, 28 Aug 2024 15:45:38 +0200 Subject: [PATCH] cmp sorting --- config/nvim/init.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 284bcb6..c823b97 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -680,8 +680,16 @@ require("lazy").setup({ luasnip.lsp_expand(args.body) end, }, - completion = { completeopt = "menu,menuone,noinsert" }, + sorting = { + priority_weight = 1, + comparators = { + cmp.config.compare.score, + cmp.config.compare.offset, + cmp.config.compare.sort_text, + }, + }, + completion = { completeopt = "menu,menuone,noinsert" }, -- For an understanding of why these mappings were -- chosen, you will need to read `:help ins-completion` -- @@ -703,9 +711,9 @@ require("lazy").setup({ -- If you prefer more traditional completion keymaps, -- you can uncomment the following lines - --[''] = cmp.mapping.confirm { select = true }, - --[''] = cmp.mapping.select_next_item(), - --[''] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), -- Manually trigger a completion from nvim-cmp. -- Generally you don't need this, because nvim-cmp will display