From 755052cea97f1cc7475a2ca121602f0a98147f07 Mon Sep 17 00:00:00 2001 From: LilleAila Date: Fri, 17 Jan 2025 20:32:10 +0100 Subject: [PATCH] mini/hues: init --- docs/release-notes/rl-0.8.md | 1 + flake.lock | 17 ++++++++++++++ flake.nix | 5 ++++ modules/plugins/mini/default.nix | 1 + modules/plugins/mini/hues/config.nix | 19 +++++++++++++++ modules/plugins/mini/hues/default.nix | 6 +++++ modules/plugins/mini/hues/hues.nix | 33 +++++++++++++++++++++++++++ 7 files changed, 82 insertions(+) create mode 100644 modules/plugins/mini/hues/config.nix create mode 100644 modules/plugins/mini/hues/default.nix create mode 100644 modules/plugins/mini/hues/hues.nix diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 25fa9b5f..1c843924 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -72,6 +72,7 @@ - `mini.fuzzy` - `mini.git` - `mini.hipatterns` + - `mini.hues` [kaktu5](https://github.com/kaktu5): diff --git a/flake.lock b/flake.lock index 1fc26c13..edb5d0c2 100644 --- a/flake.lock +++ b/flake.lock @@ -1224,6 +1224,22 @@ "type": "github" } }, + "plugin-mini-hues": { + "flake": false, + "locked": { + "lastModified": 1734960100, + "narHash": "sha256-4y79ejOkRL/fajZ4jC8t4K6EgNbnTsH++mIjmo6G3q0=", + "owner": "echasnovski", + "repo": "mini.hues", + "rev": "ae6ad4c666ff42c1102344fe1eba18bb486f2e46", + "type": "github" + }, + "original": { + "owner": "echasnovski", + "repo": "mini.hues", + "type": "github" + } + }, "plugin-minimap-vim": { "flake": false, "locked": { @@ -2438,6 +2454,7 @@ "plugin-mini-fuzzy": "plugin-mini-fuzzy", "plugin-mini-git": "plugin-mini-git", "plugin-mini-hipatterns": "plugin-mini-hipatterns", + "plugin-mini-hues": "plugin-mini-hues", "plugin-minimap-vim": "plugin-minimap-vim", "plugin-modes-nvim": "plugin-modes-nvim", "plugin-neo-tree-nvim": "plugin-neo-tree-nvim", diff --git a/flake.nix b/flake.nix index c2bc4ade..98057d45 100644 --- a/flake.nix +++ b/flake.nix @@ -835,5 +835,10 @@ url = "github:echasnovski/mini.hipatterns"; flake = false; }; + + plugin-mini-hues = { + url = "github:echasnovski/mini.hues"; + flake = false; + }; }; } diff --git a/modules/plugins/mini/default.nix b/modules/plugins/mini/default.nix index bc18dbbc..39c05cfe 100644 --- a/modules/plugins/mini/default.nix +++ b/modules/plugins/mini/default.nix @@ -18,5 +18,6 @@ ./fuzzy ./git ./hipatterns + ./hues ]; } diff --git a/modules/plugins/mini/hues/config.nix b/modules/plugins/mini/hues/config.nix new file mode 100644 index 00000000..90eea737 --- /dev/null +++ b/modules/plugins/mini/hues/config.nix @@ -0,0 +1,19 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.lua) toLuaObject; + + cfg = config.vim.mini.hues; +in { + vim = mkIf cfg.enable { + startPlugins = ["mini-hues"]; + + pluginRC.mini-hues = entryAnywhere '' + require("mini.hues").setup(${toLuaObject cfg.setupOpts}) + ''; + }; +} diff --git a/modules/plugins/mini/hues/default.nix b/modules/plugins/mini/hues/default.nix new file mode 100644 index 00000000..3eba39a6 --- /dev/null +++ b/modules/plugins/mini/hues/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./hues.nix + ./config.nix + ]; +} diff --git a/modules/plugins/mini/hues/hues.nix b/modules/plugins/mini/hues/hues.nix new file mode 100644 index 00000000..f848923a --- /dev/null +++ b/modules/plugins/mini/hues/hues.nix @@ -0,0 +1,33 @@ +{ + config, + lib, + ... +}: let + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.strings) hasPrefix; + inherit (lib.nvim.types) mkPluginSetupOption; + inherit (lib.nvim.types) hexColor; +in { + options.vim.mini.hues = { + enable = mkEnableOption "mini.hues"; + setupOpts = mkPluginSetupOption "mini.hues" { + background = mkOption { + description = "The background color to use"; + type = hexColor; + apply = v: + if hasPrefix "#" v + then v + else "#${v}"; + }; + + foreground = mkOption { + description = "The foreground color to use"; + type = hexColor; + apply = v: + if hasPrefix "#" v + then v + else "#${v}"; + }; + }; + }; +}