theming: works now!!!

This commit is contained in:
Charlie Root 2024-10-07 22:24:04 +02:00
parent c177916790
commit 0fa8fbdf6f
No known key found for this signature in database
3 changed files with 6 additions and 6 deletions

View file

@ -5,7 +5,7 @@ in {
vim.theme = { vim.theme = {
enable = mkDefault false; enable = mkDefault false;
name = mkDefault "onedark"; name = mkDefault "onedark";
style = mkDefault "darker"; # style = mkDefault "darker";
transparent = mkDefault false; transparent = mkDefault false;
extraConfig = mkDefault ""; extraConfig = mkDefault "";
}; };

View file

@ -11,7 +11,6 @@
cfg = config.vim.theme; cfg = config.vim.theme;
mkEnableOption' = name: mkEnableOption name // {default = true;}; mkEnableOption' = name: mkEnableOption name // {default = true;};
numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"]; numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"];
base16Options = listToAttrs (map (n: { base16Options = listToAttrs (map (n: {
name = "base0${n}"; name = "base0${n}";

View file

@ -10,12 +10,16 @@
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryBefore; inherit (lib.nvim.dag) entryBefore;
inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.theme; cfg = config.vim.theme;
supportedThemes = import ./supported-themes.nix { supportedThemes = import ./supported-themes.nix {
inherit lib config; inherit lib config;
}; };
in { in {
options.vim.theme = { options.vim.theme = {
themes = supportedThemes;
inherit (supportedThemes.${cfg.name}) setupOpts;
enable = mkOption { enable = mkOption {
type = bool; type = bool;
description = "Enable theming"; description = "Enable theming";
@ -28,9 +32,6 @@ in {
requires all of the colors in {option}`vim.theme.base16-colors` to be set. requires all of the colors in {option}`vim.theme.base16-colors` to be set.
''; '';
}; };
setupOpts = cfg.themes.${cfg.name}.setupOpts;
themes = supportedThemes;
style = mkOption { style = mkOption {
type = enum supportedThemes.${cfg.name}.styles; type = enum supportedThemes.${cfg.name}.styles;
default = elemAt supportedThemes.${cfg.name}.styles 0; default = elemAt supportedThemes.${cfg.name}.styles 0;
@ -59,7 +60,7 @@ in {
luaConfigRC.theme = entryBefore ["pluginConfigs"] '' luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
${cfg.extraConfig} ${cfg.extraConfig}
require('${name'}').setup(${toLuaObject cfg.themes.${cfg.name}.setupOpts}) require('${name'}').setup(${toLuaObject cfg.setupOpts})
${supportedThemes.${cfg.name}.setup} ${supportedThemes.${cfg.name}.setup}
''; '';