mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 17:28:39 +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)
|
||||
]
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue