From c32f3e7f1a313373fd482307c25bb459b8be3550 Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Wed, 28 Jun 2023 00:34:24 +0100 Subject: [PATCH] [MINOR] Added underline comparator to cmp --- .config/nvim/lua/plugins/cmp.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua index 8cf9092..29f0918 100644 --- a/.config/nvim/lua/plugins/cmp.lua +++ b/.config/nvim/lua/plugins/cmp.lua @@ -126,6 +126,19 @@ cmp.setup { cmp.config.compare.exact, cmp.config.compare.offset, cmp.config.compare.recently_used, + + --Make entries that start with underline appear after + function(entry1, entry2) + local _, entry1_under = entry1.completion_item.label:find "^_+" + local _, entry2_under = entry2.completion_item.label:find "^_+" + entry1_under = entry1_under or 0 + entry2_under = entry2_under or 0 + if entry1_under > entry2_under then + return false + elseif entry1_under < entry2_under then + return true + end + end, } }, sources = cmp.config.sources(