From a3f650e11482fdbba65774982f0374ea2c7bef0e Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 28 Feb 2025 03:34:03 +0300 Subject: [PATCH] ui/illuminate: move to setupOpts format --- modules/plugins/ui/illuminate/config.nix | 20 +++++++++----------- modules/plugins/ui/illuminate/illuminate.nix | 16 ++++++++++++++-- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/modules/plugins/ui/illuminate/config.nix b/modules/plugins/ui/illuminate/config.nix index ffba85fe..37ad4cfa 100644 --- a/modules/plugins/ui/illuminate/config.nix +++ b/modules/plugins/ui/illuminate/config.nix @@ -4,22 +4,20 @@ ... }: let inherit (lib.modules) mkIf; + inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.ui.illuminate; in { config = mkIf cfg.enable { - vim.startPlugins = ["vim-illuminate"]; + vim = { + startPlugins = ["vim-illuminate"]; - vim.pluginRC.vim-illuminate = entryAnywhere '' - require('illuminate').configure({ - filetypes_denylist = { - 'dirvish', - 'fugitive', - 'NvimTree', - 'TelescopePrompt', - }, - }) - ''; + # vim-illuminate does not have a setup function. It is instead called 'configure' + # and does what you expect from a setup function. Wild. + pluginRC.vim-illuminate = entryAnywhere '' + require('illuminate').configure(${toLuaObject cfg.setupOpts}) + ''; + }; }; } diff --git a/modules/plugins/ui/illuminate/illuminate.nix b/modules/plugins/ui/illuminate/illuminate.nix index c9c5d2f8..b910101f 100644 --- a/modules/plugins/ui/illuminate/illuminate.nix +++ b/modules/plugins/ui/illuminate/illuminate.nix @@ -1,7 +1,19 @@ {lib, ...}: let - inherit (lib.options) mkEnableOption; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) listOf str; + inherit (lib.nvim.types) mkPluginSetupOption; in { options.vim.ui.illuminate = { - enable = mkEnableOption "automatically highlight other uses of the word under the cursor [vim-illuminate]"; + enable = mkEnableOption '' + automatically highlight other uses of the word under the cursor [vim-illuminate] + ''; + + setupOpts = mkPluginSetupOption "vim-illuminate" { + filetypes_denylist = mkOption { + type = listOf str; + default = ["dirvish" "fugitive" "NvimTree" "TelescopePrompt"]; + description = "Filetypes to not illuminate, this overrides `filetypes_allowlist`"; + }; + }; }; }