Skip to content

Commit

Permalink
colorschemes/nord: switch to mkVimPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage committed Feb 28, 2024
1 parent b87083d commit be87309
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 68 deletions.
104 changes: 44 additions & 60 deletions plugins/colorschemes/nord.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,60 @@
pkgs,
...
}:
with lib; let
cfg = config.colorschemes.nord;
in {
options = {
colorschemes.nord = {
enable = mkEnableOption "nord";
helpers.vim-plugin.mkVimPlugin config {
namespace = "colorschemes";
name = "nord";
originalName = "nord.nvim";
defaultPackage = pkgs.vimPlugins.nord-nvim;
globalPrefix = "nord_";

package = helpers.mkPackageOption "nord.nvim" pkgs.vimPlugins.nord-nvim;
maintainers = [lib.maintainers.GaetanLepage];

contrast = helpers.defaultNullOpts.mkBool false ''
Make sidebars and popup menus like nvim-tree and telescope have a different background.
'';
# TODO introduced 2024-02-20: remove 2024-04-20
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"contrast"
"borders"
"disableBackground"
"cursorlineTransparent"
"enableSidebarBackground"
"italic"
"uniformDiffBackground"
];

borders = helpers.defaultNullOpts.mkBool false ''
Enable the border between verticaly split windows visable.
'';
settingsOptions = {
contrast = helpers.defaultNullOpts.mkBool false ''
Make sidebars and popup menus like nvim-tree and telescope have a different background.
'';

disableBackground = helpers.defaultNullOpts.mkBool false ''
Disable the setting of background color so that NeoVim can use your terminal background.
'';
borders = helpers.defaultNullOpts.mkBool false ''
Enable the border between verticaly split windows visable.
'';

cursorlineTransparent = helpers.defaultNullOpts.mkBool false ''
Set the cursorline transparent/visible.
'';
disable_background = helpers.defaultNullOpts.mkBool false ''
Disable the setting of background color so that NeoVim can use your terminal background.
'';

enableSidebarBackground = helpers.defaultNullOpts.mkBool false ''
Re-enables the background of the sidebar if you disabled the background of everything.
'';
cursorline_transparent = helpers.defaultNullOpts.mkBool false ''
Set the cursorline transparent/visible.
'';

italic = helpers.defaultNullOpts.mkBool true ''
Enables/disables italics.
'';
enable_sidebar_background = helpers.defaultNullOpts.mkBool false ''
Re-enables the background of the sidebar if you disabled the background of everything.
'';

uniformDiffBackground = helpers.defaultNullOpts.mkBool false ''
Enables/disables colorful backgrounds when used in _diff_ mode.
'';
italic = helpers.defaultNullOpts.mkBool true ''
Enables/disables italics.
'';

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 = {};
};
};
uniform_diff_background = helpers.defaultNullOpts.mkBool false ''
Enables/disables colorful backgrounds when used in _diff_ mode.
'';
};

config = mkIf cfg.enable {
colorscheme = "nord";
extraPlugins = [cfg.package];

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);
settingsExample = {
borders = true;
disable_background = true;
italic = false;
};
}
17 changes: 9 additions & 8 deletions tests/test-sources/plugins/colorschemes/nord.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
colorschemes.nord = {
enable = true;

contrast = false;
borders = false;
disableBackground = false;
cursorlineTransparent = false;
enableSidebarBackground = false;
italic = true;
uniformDiffBackground = false;
extraConfig = {};
settings = {
contrast = false;
borders = false;
disable_background = false;
cursorline_transparent = false;
enable_sidebar_background = false;
italic = true;
uniform_diff_background = false;
};
};
};
}

0 comments on commit be87309

Please sign in to comment.