colorschemes/nord: switch to mkVimPlugin

This commit is contained in:
Gaetan Lepage 2024-02-13 15:01:49 +01:00 committed by Gaétan Lepage
parent b87083d5a0
commit be87309e0c
2 changed files with 53 additions and 68 deletions

View file

@ -5,15 +5,28 @@
pkgs, pkgs,
... ...
}: }:
with lib; let helpers.vim-plugin.mkVimPlugin config {
cfg = config.colorschemes.nord; namespace = "colorschemes";
in { name = "nord";
options = { originalName = "nord.nvim";
colorschemes.nord = { defaultPackage = pkgs.vimPlugins.nord-nvim;
enable = mkEnableOption "nord"; globalPrefix = "nord_";
package = helpers.mkPackageOption "nord.nvim" pkgs.vimPlugins.nord-nvim; maintainers = [lib.maintainers.GaetanLepage];
# TODO introduced 2024-02-20: remove 2024-04-20
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"contrast"
"borders"
"disableBackground"
"cursorlineTransparent"
"enableSidebarBackground"
"italic"
"uniformDiffBackground"
];
settingsOptions = {
contrast = helpers.defaultNullOpts.mkBool false '' contrast = helpers.defaultNullOpts.mkBool false ''
Make sidebars and popup menus like nvim-tree and telescope have a different background. Make sidebars and popup menus like nvim-tree and telescope have a different background.
''; '';
@ -22,15 +35,15 @@ in {
Enable the border between verticaly split windows visable. Enable the border between verticaly split windows visable.
''; '';
disableBackground = helpers.defaultNullOpts.mkBool false '' disable_background = helpers.defaultNullOpts.mkBool false ''
Disable the setting of background color so that NeoVim can use your terminal background. Disable the setting of background color so that NeoVim can use your terminal background.
''; '';
cursorlineTransparent = helpers.defaultNullOpts.mkBool false '' cursorline_transparent = helpers.defaultNullOpts.mkBool false ''
Set the cursorline transparent/visible. Set the cursorline transparent/visible.
''; '';
enableSidebarBackground = helpers.defaultNullOpts.mkBool false '' enable_sidebar_background = helpers.defaultNullOpts.mkBool false ''
Re-enables the background of the sidebar if you disabled the background of everything. Re-enables the background of the sidebar if you disabled the background of everything.
''; '';
@ -38,43 +51,14 @@ in {
Enables/disables italics. Enables/disables italics.
''; '';
uniformDiffBackground = helpers.defaultNullOpts.mkBool false '' uniform_diff_background = helpers.defaultNullOpts.mkBool false ''
Enables/disables colorful backgrounds when used in _diff_ mode. Enables/disables colorful backgrounds when used in _diff_ mode.
''; '';
extraConfig = mkOption {
type = types.attrs;
description = ''
The configuration options for vimtex without the 'nord_' prefix.
Example: To set 'nord_foo_bar' to 1, write
extraConfig = {
foo_bar = true;
};
'';
default = {};
};
};
}; };
config = mkIf cfg.enable { settingsExample = {
colorscheme = "nord"; borders = true;
extraPlugins = [cfg.package]; disable_background = true;
italic = false;
globals =
mapAttrs'
(name: value: nameValuePair "nord_${name}" value)
(with cfg;
{
inherit
contrast
borders
;
disable_background = disableBackground;
cursorline_transparent = cursorlineTransparent;
enable_sidebar_background = enableSidebarBackground;
inherit italic;
uniform_diff_background = uniformDiffBackground;
}
// cfg.extraConfig);
}; };
} }

View file

@ -7,14 +7,15 @@
colorschemes.nord = { colorschemes.nord = {
enable = true; enable = true;
settings = {
contrast = false; contrast = false;
borders = false; borders = false;
disableBackground = false; disable_background = false;
cursorlineTransparent = false; cursorline_transparent = false;
enableSidebarBackground = false; enable_sidebar_background = false;
italic = true; italic = true;
uniformDiffBackground = false; uniform_diff_background = false;
extraConfig = {}; };
}; };
}; };
} }