mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-22 11:45:28 +02:00
lualine: fix components config (#47)
This commit is contained in:
parent
a38d531bf4
commit
931db3e83f
1 changed files with 38 additions and 21 deletions
|
@ -20,27 +20,36 @@ let
|
||||||
});
|
});
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
component_options = mode:
|
component_options = defaultName:
|
||||||
mkOption {
|
mkOption {
|
||||||
type = types.nullOr (types.submodule {
|
type = types.nullOr (types.listOf (types.oneOf [
|
||||||
options = {
|
types.str
|
||||||
mode = mkOption {
|
(types.submodule {
|
||||||
type = types.str;
|
options = {
|
||||||
default = "${mode}";
|
name = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "component name";
|
||||||
|
default = defaultName;
|
||||||
|
};
|
||||||
|
icons_enabled = mkOption {
|
||||||
|
type = types.enum [ "True" "False" ];
|
||||||
|
default = "True";
|
||||||
|
description = "displays icons in alongside component";
|
||||||
|
};
|
||||||
|
icon = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = "displays icon in front of the component";
|
||||||
|
};
|
||||||
|
separator = separators;
|
||||||
|
extraConfig = mkOption {
|
||||||
|
type = types.attrs;
|
||||||
|
default = { };
|
||||||
|
description = "extra options for the component";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
icons_enabled = mkOption {
|
})
|
||||||
type = types.enum [ "True" "False" ];
|
]));
|
||||||
default = "True";
|
|
||||||
description = "displays icons in alongside component";
|
|
||||||
};
|
|
||||||
icon = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = null;
|
|
||||||
description = "displays icon in front of the component";
|
|
||||||
};
|
|
||||||
separator = separators;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
@ -112,6 +121,14 @@ in
|
||||||
};
|
};
|
||||||
config =
|
config =
|
||||||
let
|
let
|
||||||
|
processComponent = x: (if isAttrs x then processTableComponent else id) x;
|
||||||
|
processTableComponent = { name, icons_enabled, icon, separator, extraConfig }: mergeAttrs
|
||||||
|
{
|
||||||
|
"@" = name;
|
||||||
|
inherit icons_enabled icon separator;
|
||||||
|
}
|
||||||
|
extraConfig;
|
||||||
|
processSections = sections: mapAttrs (_: mapNullable (map processComponent)) sections;
|
||||||
setupOptions = {
|
setupOptions = {
|
||||||
options = {
|
options = {
|
||||||
theme = cfg.theme;
|
theme = cfg.theme;
|
||||||
|
@ -121,8 +138,8 @@ in
|
||||||
always_divide_middle = cfg.alwaysDivideMiddle;
|
always_divide_middle = cfg.alwaysDivideMiddle;
|
||||||
};
|
};
|
||||||
|
|
||||||
sections = cfg.sections;
|
sections = mapNullable processSections cfg.sections;
|
||||||
tabline = cfg.tabline;
|
tabline = mapNullable processSections cfg.tabline;
|
||||||
extensions = cfg.extensions;
|
extensions = cfg.extensions;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue