colorschemes/poimandres: switch to mkNeovimPlugin

This commit is contained in:
Gaetan Lepage 2024-04-15 14:01:40 +02:00 committed by Gaétan Lepage
parent 6440f4af87
commit 16272920e2
2 changed files with 89 additions and 78 deletions

View file

@ -5,59 +5,69 @@
config, config,
... ...
}: }:
with lib; let with lib;
cfg = config.colorschemes.poimandres; helpers.neovim-plugin.mkNeovimPlugin config {
in { name = "poimandres";
options = { isColorscheme = true;
colorschemes.poimandres = originalName = "poimandres.nvim";
helpers.neovim-plugin.extraOptionsOptions defaultPackage = pkgs.vimPlugins.poimandres-nvim;
// {
enable = mkEnableOption "poimandres";
package = helpers.mkPackageOption "poimandres" pkgs.vimPlugins.poimandres-nvim; maintainers = [maintainers.GaetanLepage];
boldVertSplit = helpers.defaultNullOpts.mkBool false "bold vertical split"; # TODO introduced 2024-04-15: remove 2024-06-15
deprecateExtraOptions = true;
optionsRenamedToSettings = [
"boldVertSplit"
"darkVariant"
"disableBackground"
"disableFloatBackground"
"disableItalics"
"dimNcBackground"
"groups"
"highlightGroups"
];
darkVariant = helpers.defaultNullOpts.mkStr "main" "dark variant"; settingsOptions = {
bold_vert_split = helpers.defaultNullOpts.mkBool false ''
Use bold vertical separators.
'';
disableBackground = helpers.defaultNullOpts.mkBool false "Whether to disable the background."; dim_nc_background = helpers.defaultNullOpts.mkBool false ''
Dim 'non-current' window backgrounds.
'';
disableFloatBackground = disable_background = helpers.defaultNullOpts.mkBool false ''
helpers.defaultNullOpts.mkBool false Whether to disable the background.
"Whether to disable the float background."; '';
disableItalics = helpers.defaultNullOpts.mkBool false "Whether to disable italics."; disable_float_background = helpers.defaultNullOpts.mkBool false ''
Whether to disable the background for floats.
'';
dimNcBackground = helpers.defaultNullOpts.mkBool false "Dim NC background"; disable_italics = helpers.defaultNullOpts.mkBool false ''
Whether to disable italics.
'';
groups = dark_variant = helpers.defaultNullOpts.mkStr "main" ''
helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str))) Dark variant.
"groups"; '';
highlightGroups = helpers.mkNullOrOption types.attrs "highlight groups"; groups = helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str))) ''
}; Which color to use for each group.
};
config = let
setupOptions =
{
bold_vert_split = cfg.boldVertSplit;
dark_variant = cfg.darkVariant;
disable_background = cfg.disableBackground;
disable_float_background = cfg.disableFloatBackground;
disable_italics = cfg.disableItalics;
dim_nc_background = cfg.dimNcBackground;
inherit (cfg) groups;
highlight_groups = cfg.highlightGroups;
}
// cfg.extraOptions;
in
mkIf cfg.enable {
colorscheme = "poimandres";
extraPlugins = [cfg.package]; default: see [source](https://github.com/olivercederborg/poimandres.nvim/blob/main/lua/poimandres/init.lua)
'';
extraConfigLuaPre = '' highlight_groups = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
require("poimandres").setup(${helpers.toLuaObject setupOptions}) Highlight groups.
''; '';
}; };
}
settingsExample = {
bold_vert_split = false;
dim_nc_background = true;
disable_background = false;
disable_float_background = false;
disable_italics = true;
};
}

View file

@ -7,46 +7,47 @@
colorschemes.poimandres = { colorschemes.poimandres = {
enable = true; enable = true;
boldVertSplit = false; settings = {
darkVariant = "main"; bold_vert_split = false;
disableBackground = false; dim_nc_background = false;
disableFloatBackground = false; disable_background = false;
disableItalics = false; disable_float_background = false;
dimNcBackground = false; disable_italics = false;
dark_variant = "main";
groups = {
background = "background2";
panel = "background3";
border = "background3";
comment = "blueGray3";
link = "blue3";
punctuation = "blue3";
groups = { error = "pink3";
background = "background2"; hint = "blue1";
panel = "background3"; info = "blue3";
border = "background3"; warn = "yellow";
comment = "blueGray3";
link = "blue3";
punctuation = "blue3";
error = "pink3"; git_add = "teal1";
hint = "blue1"; git_change = "blue2";
info = "blue3"; git_delete = "pink3";
warn = "yellow"; git_dirty = "blue4";
git_ignore = "blueGray1";
git_merge = "blue2";
git_rename = "teal3";
git_stage = "blue1";
git_text = "teal2";
git_add = "teal1"; headings = {
git_change = "blue2"; h1 = "teal2";
git_delete = "pink3"; h2 = "yellow";
git_dirty = "blue4"; h3 = "pink3";
git_ignore = "blueGray1"; h4 = "pink2";
git_merge = "blue2"; h5 = "blue1";
git_rename = "teal3"; h6 = "blue2";
git_stage = "blue1"; };
git_text = "teal2";
headings = {
h1 = "teal2";
h2 = "yellow";
h3 = "pink3";
h4 = "pink2";
h5 = "blue1";
h6 = "blue2";
}; };
highlight_groups = {};
}; };
highlightGroups = {};
}; };
}; };
} }