mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-22 03:35:21 +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;
|
||||
};
|
||||
component_options = mode:
|
||||
component_options = defaultName:
|
||||
mkOption {
|
||||
type = types.nullOr (types.submodule {
|
||||
options = {
|
||||
mode = mkOption {
|
||||
type = types.str;
|
||||
default = "${mode}";
|
||||
type = types.nullOr (types.listOf (types.oneOf [
|
||||
types.str
|
||||
(types.submodule {
|
||||
options = {
|
||||
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;
|
||||
};
|
||||
in
|
||||
|
@ -112,6 +121,14 @@ in
|
|||
};
|
||||
config =
|
||||
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 = {
|
||||
options = {
|
||||
theme = cfg.theme;
|
||||
|
@ -121,8 +138,8 @@ in
|
|||
always_divide_middle = cfg.alwaysDivideMiddle;
|
||||
};
|
||||
|
||||
sections = cfg.sections;
|
||||
tabline = cfg.tabline;
|
||||
sections = mapNullable processSections cfg.sections;
|
||||
tabline = mapNullable processSections cfg.tabline;
|
||||
extensions = cfg.extensions;
|
||||
};
|
||||
in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue