From c9597b37d893e33aef9e18df8c916eae8974a115 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 24 Mar 2025 09:13:18 +0100 Subject: [PATCH] plugins/obsidian: adapt options (now using the obsidian-nvim community fork) --- plugins/by-name/obsidian/default.nix | 23 +++++++++++++------ plugins/by-name/obsidian/settings-options.nix | 5 ++++ .../plugins/by-name/obsidian/default.nix | 23 +++++++++++++++++++ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/plugins/by-name/obsidian/default.nix b/plugins/by-name/obsidian/default.nix index ed52746e..00d45ef5 100644 --- a/plugins/by-name/obsidian/default.nix +++ b/plugins/by-name/obsidian/default.nix @@ -88,12 +88,21 @@ lib.nixvim.plugins.mkNeovimPlugin { }; extraConfig = cfg: { - warnings = lib.nixvim.mkWarnings "plugins.obsidian" { - when = (cfg.settings.completion.nvim_cmp == true) && (!config.plugins.cmp.enable); - message = '' - You have enabled `completion.nvim_cmp` but `plugins.cmp.enable` is `false`. - You should probably enable `nvim-cmp`. - ''; - }; + warnings = lib.nixvim.mkWarnings "plugins.obsidian" [ + { + when = (cfg.settings.completion.nvim_cmp == true) && (!config.plugins.cmp.enable); + message = '' + You have enabled `completion.nvim_cmp` but `plugins.cmp.enable` is `false`. + You should probably enable `nvim-cmp`. + ''; + } + { + when = (cfg.settings.completion.blink == true) && (!config.plugins.blink-cmp.enable); + message = '' + You have enabled `completion.blink` but `plugins.blink-cmp.enable` is `false`. + You should probably enable `blink-cmp`. + ''; + } + ]; }; } diff --git a/plugins/by-name/obsidian/settings-options.nix b/plugins/by-name/obsidian/settings-options.nix index a12a31f3..d34f36fe 100644 --- a/plugins/by-name/obsidian/settings-options.nix +++ b/plugins/by-name/obsidian/settings-options.nix @@ -215,6 +215,10 @@ in defaultText = lib.literalMD "`true` if `plugins.cmp.enable` is enabled (otherwise `null`)."; }; + blink = defaultNullOpts.mkBool false '' + Enable completion using blink.cmp. + ''; + min_chars = defaultNullOpts.mkUnsignedInt 2 '' Trigger completion at this many chars. ''; @@ -263,6 +267,7 @@ in "telescope.nvim" "fzf-lua" "mini.pick" + "snacks.pick" ]) '' Set your preferred picker. diff --git a/tests/test-sources/plugins/by-name/obsidian/default.nix b/tests/test-sources/plugins/by-name/obsidian/default.nix index 091a044b..9d8ce200 100644 --- a/tests/test-sources/plugins/by-name/obsidian/default.nix +++ b/tests/test-sources/plugins/by-name/obsidian/default.nix @@ -32,6 +32,7 @@ new_notes_location = "current_dir"; completion = { nvim_cmp = true; + blink = false; min_chars = 2; }; }; @@ -39,6 +40,28 @@ }; }; + blink-cmp = { + # Issue within the obsidian.nvim plugin itself: + # ERROR: cmp.add_provider is deprecated, use cmp.add_source_provider instead. + test.runNvim = false; + + plugins = { + blink-cmp.enable = true; + obsidian = { + enable = true; + settings = { + completion.blink = true; + workspaces = [ + { + name = "foo"; + path = "~/"; + } + ]; + }; + }; + }; + }; + complete-example = { plugins = { cmp.enable = true;