diff --git a/lib/vim-plugin.nix b/lib/vim-plugin.nix index df5e59d3e9..e59b00df03 100644 --- a/lib/vim-plugin.nix +++ b/lib/vim-plugin.nix @@ -6,7 +6,7 @@ with lib; { mkVimPlugin = config: { name, - namespace ? "plugins", + colorscheme ? false, url ? if defaultPackage != null then defaultPackage.meta.homepage @@ -29,6 +29,11 @@ with lib; { extraPlugins ? [], extraPackages ? [], }: let + namespace = + if colorscheme + then "colorschemes" + else "plugins"; + cfg = config.${namespace}.${name}; # TODO support nested options! @@ -143,6 +148,11 @@ with lib; { # does this evaluate package? it would not be desired to evaluate package if we use another package. extraPlugins = extraPlugins ++ optional (defaultPackage != null) cfg.package; } + (optionalAttrs colorscheme { + # We use `mkDefault` here to let individual plugins override this option. + # For instance, setting it to `null` a specific way of setting the coloscheme. + colorscheme = lib.mkDefault name; + }) (extraConfig cfg) ] ); diff --git a/plugins/colorschemes/nord.nix b/plugins/colorschemes/nord.nix index cafa52cc61..84d49936b4 100644 --- a/plugins/colorschemes/nord.nix +++ b/plugins/colorschemes/nord.nix @@ -6,8 +6,8 @@ ... }: helpers.vim-plugin.mkVimPlugin config { - namespace = "colorschemes"; name = "nord"; + colorscheme = true; originalName = "nord.nvim"; defaultPackage = pkgs.vimPlugins.nord-nvim; globalPrefix = "nord_"; @@ -61,8 +61,4 @@ helpers.vim-plugin.mkVimPlugin config { disable_background = true; italic = false; }; - - extraConfig = cfg: { - colorscheme = "nord"; - }; }