Skip to content

Commit

Permalink
colorschemes/ayu: switch to mkNeovimPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage committed Feb 18, 2024
1 parent efdd9f2 commit 9ec2de0
Showing 1 changed file with 33 additions and 37 deletions.
70 changes: 33 additions & 37 deletions plugins/colorschemes/ayu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,47 @@
pkgs,
...
}:
with lib; let
cfg = config.colorschemes.ayu;
in {
options = {
colorschemes.ayu =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "ayu";
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "ayu";
namespace = "colorschemes";
originalName = "neovim-ayu";
defaultPackage = pkgs.vimPlugins.neovim-ayu;
callSetup = false;

package = helpers.mkPackageOption "ayu" pkgs.vimPlugins.neovim-ayu;
maintainers = [maintainers.GaetanLepage];

mirage = helpers.defaultNullOpts.mkBool false ''
Set to `true` to use `mirage` variant instead of `dark` for dark background.
'';
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"mirage"
"overrides"
];

overrides =
helpers.defaultNullOpts.mkStrLuaOr
(with helpers.nixvimTypes; attrsOf highlight)
"{}"
''
A dictionary of group names, each associated with a dictionary of parameters
(`bg`, `fg`, `sp` and `style`) and colors in hex.
settingsOptions = {
mirage = helpers.defaultNullOpts.mkBool false ''
Set to `true` to use `mirage` variant instead of `dark` for dark background.
'';

Alternatively, `overrides` can be a function that returns a dictionary of the same
format.
You can use the function to override based on a dynamic condition, such as the value of
`background`.
'';
};
};
overrides =
helpers.defaultNullOpts.mkStrLuaOr
(with helpers.nixvimTypes; attrsOf highlight)
"{}"
''
A dictionary of group names, each associated with a dictionary of parameters
(`bg`, `fg`, `sp` and `style`) and colors in hex.
config = let
setupOptions = with cfg;
{
inherit overrides;
}
// cfg.extraOptions;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
Alternatively, `overrides` can be a function that returns a dictionary of the same
format.
You can use the function to override based on a dynamic condition, such as the value of
`background`.
'';
};

extraConfig = cfg: {
extraConfigLuaPre = ''
local ayu = require("ayu")
ayu.setup(${helpers.toLuaObject setupOptions})
ayu.setup(${helpers.toLuaObject cfg.settings})
ayu.colorscheme()
'';
};
}
}

0 comments on commit 9ec2de0

Please sign in to comment.