From 237bd242055fae1c8d9657cb799b49f21dd03464 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 21 May 2025 11:35:31 +0200 Subject: [PATCH] Proper integration of lbdb for mail only --- .config/lazyvim/lua/plugins/blink-cmp.lua | 4 ++ .../lazyvim/lua/plugins/blink-compat-lbdb.lua | 49 +++++++++++-------- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/.config/lazyvim/lua/plugins/blink-cmp.lua b/.config/lazyvim/lua/plugins/blink-cmp.lua index ba6ec81..8418e2f 100644 --- a/.config/lazyvim/lua/plugins/blink-cmp.lua +++ b/.config/lazyvim/lua/plugins/blink-cmp.lua @@ -11,6 +11,10 @@ return { }, }, }, + default = { "lsp", "buffer", "snippets", "path", "lazydev" }, + per_filetype = { + mail = { "lbdb", "emoji", "snippets", "path" }, + }, }, keymap = { preset = "default", diff --git a/.config/lazyvim/lua/plugins/blink-compat-lbdb.lua b/.config/lazyvim/lua/plugins/blink-compat-lbdb.lua index 19eee59..9a31659 100644 --- a/.config/lazyvim/lua/plugins/blink-compat-lbdb.lua +++ b/.config/lazyvim/lua/plugins/blink-compat-lbdb.lua @@ -1,29 +1,38 @@ return { { - "saghen/blink.cmp", + "codybuell/cmp-lbdb", + version = "1.*", dependencies = { { "saghen/blink.compat" }, - { "codybuell/cmp-lbdb" }, - }, - version = "1.*", - opts = { - sources = { - default = { "lbdb" }, - providers = { - lbdb = { - name = "lbdb", - module = "blink.compat.source", - score_offset = -3, + { + "saghen/blink.cmp", + opts = { + sources = { + providers = { + lbdb = { + name = "lbdb", + module = "blink.compat.source", + score_offset = -3, - opts = { - filetypes = { - "mail", - }, - blacklist = { - ".*noreply.*", + opts = { + filetypes = { + "mail", + }, + blacklist = { + ".*noreply.*", + }, + mail_header_only = true, + use_quotes = true, + }, + transform_items = function(_, items) + local kind = require("blink.cmp.types").CompletionItemKind.Text + for i = 1, #items do + items[i].kind = kind + items[i].kind_icon = "🪪" + end + return items + end, }, - mail_header_only = true, - use_quotes = true, }, }, }, -- 2.39.5