From 8e1dbc7df2385be64871f9155773175b8ff845ba Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sat, 11 Jan 2025 21:32:30 +0100 Subject: [PATCH] lspkind: integration with blink.cmp --- modules/plugins/lsp/lspkind/config.nix | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/modules/plugins/lsp/lspkind/config.nix b/modules/plugins/lsp/lspkind/config.nix index 2ef20ff8..abe14524 100644 --- a/modules/plugins/lsp/lspkind/config.nix +++ b/modules/plugins/lsp/lspkind/config.nix @@ -8,16 +8,18 @@ inherit (lib.nvim.lua) toLuaObject; cfg = config.vim.lsp.lspkind; + usingCmp = config.vim.autocomplete.nvim-cmp.enable; + usingBlink = config.vim.autocomplete.blink-cmp.enable; in { config = mkIf cfg.enable { assertions = [ { - assertion = config.vim.autocomplete.nvim-cmp.enable; + assertion = usingCmp || usingBlink; message = '' While lspkind supports Neovim's native lsp upstream, using that over - nvim-cmp isn't recommended, nor supported by nvf. + nvim-cmp/blink.cmp isn't recommended, nor supported by nvf. - Please migrate to nvim-cmp if you want to use lspkind. + Please migrate to nvim-cmp/blink.cmp if you want to use lspkind. ''; } ]; @@ -26,9 +28,19 @@ in { startPlugins = ["lspkind"]; lsp.lspkind.setupOpts.before = config.vim.autocomplete.nvim-cmp.format; - autocomplete.nvim-cmp.setupOpts.formatting.format = mkForce (mkLuaInline '' - require("lspkind").cmp_format(${toLuaObject cfg.setupOpts}) - ''); + autocomplete = { + nvim-cmp = mkIf usingCmp { + setupOpts.formatting.format = mkForce (mkLuaInline '' + require("lspkind").cmp_format(${toLuaObject cfg.setupOpts}) + ''); + }; + + blink-cmp = mkIf usingBlink { + setupOpts.appearance.kind_icons = mkLuaInline '' + require("lspkind").symbol_map + ''; + }; + }; }; }; }