From 449b943b9579f8104438fa4d580333c54c74bfca Mon Sep 17 00:00:00 2001 From: alfarel Date: Tue, 25 Feb 2025 23:17:19 -0500 Subject: [PATCH] completion/blink-cmp: option to enable friendly-snippets Just adds it to the environment, `blink-cmp` will pick up on it automatically. --- docs/release-notes/rl-0.8.md | 3 +++ modules/plugins/completion/blink-cmp/blink-cmp.nix | 2 ++ modules/plugins/completion/blink-cmp/config.nix | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index a28ffd67..dfc232b8 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -207,6 +207,9 @@ - Add [direnv.vim](https://github.com/direnv/direnv.vim) plugin for automatic syncing of nvim shell environment with direnv's. - Add [blink.cmp] source options and some default-disabled sources. +- Add [blink.cmp] option to add + [friendly-snippets](https://github.com/rafamadriz/friendly-snippets) + so blink.cmp can source snippets from it. [TheColorman](https://github.com/TheColorman) diff --git a/modules/plugins/completion/blink-cmp/blink-cmp.nix b/modules/plugins/completion/blink-cmp/blink-cmp.nix index 9bb76b71..4290e1cb 100644 --- a/modules/plugins/completion/blink-cmp/blink-cmp.nix +++ b/modules/plugins/completion/blink-cmp/blink-cmp.nix @@ -177,5 +177,7 @@ in { Attribute names must be source names used in {option}`vim.autocomplete.blink-cmp.setupOpts.sources.default`. ''; }; + + friendly-snippets.enable = mkEnableOption "friendly-snippets for blink to source from automatically"; }; } diff --git a/modules/plugins/completion/blink-cmp/config.nix b/modules/plugins/completion/blink-cmp/config.nix index 96ced502..875a4fd4 100644 --- a/modules/plugins/completion/blink-cmp/config.nix +++ b/modules/plugins/completion/blink-cmp/config.nix @@ -7,7 +7,7 @@ inherit (lib.strings) optionalString; inherit (lib.generators) mkLuaInline; inherit (lib.attrsets) attrValues filterAttrs; - inherit (lib.lists) map; + inherit (lib.lists) map optional; inherit (lib.nvim.lua) toLuaObject; inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs; @@ -26,7 +26,7 @@ blinkSourcePlugins = map (definition: definition.package) (attrValues enabledBlinkSources); in { vim = mkIf cfg.enable { - startPlugins = ["blink-compat"] ++ blinkSourcePlugins; + startPlugins = ["blink-compat"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets"); lazy.plugins = { blink-cmp = { package = "blink-cmp";