diff options
| author | Mike Vink <> | 2023-04-14 10:17:27 +0200 |
|---|---|---|
| committer | Mike Vink <> | 2023-04-14 10:17:27 +0200 |
| commit | faa30a17f9581590fdac156280147effd0e51f46 (patch) | |
| tree | 50a79752d937a791b19448f237d14902567bdc71 /fnl/conf | |
| parent | 5bf899a658326ce0cc09c6373443ac4caf002c60 (diff) | |
fixup
Diffstat (limited to 'fnl/conf')
| -rw-r--r-- | fnl/conf/pkgs/cmp.fnl | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/fnl/conf/pkgs/cmp.fnl b/fnl/conf/pkgs/cmp.fnl index 12cbec3..8e572fe 100644 --- a/fnl/conf/pkgs/cmp.fnl +++ b/fnl/conf/pkgs/cmp.fnl @@ -1,5 +1,6 @@ (local cmp (require :cmp)) (local compare (require :cmp.config.compare)) +(local always-first [:write :edit :split :quit]) (fn string-startswith? [str start] (= start (string.sub str 1 (string.len start)))) @@ -66,17 +67,31 @@ :experimental {:ghost_text true} :mapping (cmp.mapping.preset.cmdline)}) (cmp.setup.cmdline ":" - {:matching {:disallow_partial_matching true + {:matching {:disallow_partial_fuzzy_matching true :disallow_prefix_unmatching true} :sources (cmp.config.sources [{:name :path}] [{:name :cmdline - :keyword_length 1 - :entry_filter (fn [entry - ctx] - (not (string-startswith-anyof? entry.completion_item.label - [:w - :sp])))}]) + :keyword_length 1}]) :preselect cmp.PreselectMode.Item + :sorting {:priority_weight 2 + :comparators [(fn [e1 e2] + (fn iter [[item & rest]] + (if (or (not rest) + (not item)) + false + (= e1.completion_item.label + item) + true + (iter rest))) + + (iter always-first)) + compare.offset + compare.exact + compare.score + compare.locality + compare.kind + compare.length + compare.order]} :mapping (cmp.mapping.preset.cmdline {:<CR> {:c (fn [fallback] (if (not (cmp.confirm {:behavior (enum :ConfirmBehavior :Replace) |
