From 506c52fb83e63712cb21778dc56c9ca6c847f348 Mon Sep 17 00:00:00 2001
From: Bruno BELANYI <bruno@belanyi.fr>
Date: Mon, 7 Mar 2022 15:27:57 +0100
Subject: [PATCH] home: vim: completion: add 'cmp-under-comparator'

---
 home/vim/default.nix                    | 1 +
 home/vim/plugin/settings/completion.vim | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/home/vim/default.nix b/home/vim/default.nix
index 12454cb..485ae70 100644
--- a/home/vim/default.nix
+++ b/home/vim/default.nix
@@ -74,6 +74,7 @@ in
       cmp-path # Path name suggestions
       cmp-nvim-lsp # LSP suggestions
       cmp-nvim-lua # NeoVim lua API
+      cmp-under-comparator # Sort items that start with '_' lower
 
       # UX improvements
       dressing-nvim # Integrate native UI hooks with Telescope etc...
diff --git a/home/vim/plugin/settings/completion.vim b/home/vim/plugin/settings/completion.vim
index 1553c2b..a3e9356 100644
--- a/home/vim/plugin/settings/completion.vim
+++ b/home/vim/plugin/settings/completion.vim
@@ -3,6 +3,7 @@ set completeopt=menu,menuone,noselect
 
 lua << EOF
 local cmp = require("cmp")
+local cmp_under_comparator = require("cmp-under-comparator")
 
 cmp.setup({
     mapping = {
@@ -67,6 +68,7 @@ cmp.setup({
             cmp.config.compare.offset,
             cmp.config.compare.exact,
             cmp.config.compare.score,
+            cmp_under_comparator.under,
             cmp.config.compare.kind,
             cmp.config.compare.sort_text,
             cmp.config.compare.length,