mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
helpers/vim-plugin/mkVimPlugin: add a colorscheme argument and factor out logic
This commit is contained in:
parent
3c9a4b67ae
commit
601010900b
2 changed files with 12 additions and 6 deletions
|
@ -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)
|
||||
]
|
||||
);
|
||||
|
|
|
@ -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";
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue