mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 09:18:38 +02:00
feat: allow custom formatting for status components (#1018)
This commit is contained in:
parent
7a952a4e32
commit
a89c8a9a97
2 changed files with 18 additions and 1 deletions
|
@ -80,6 +80,17 @@ with lib; let
|
||||||
"1"
|
"1"
|
||||||
"Adds padding to the left and right of components.";
|
"Adds padding to the left and right of components.";
|
||||||
|
|
||||||
|
fmt = helpers.mkNullOrLuaFn ''
|
||||||
|
A lua function to format the component string.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```lua
|
||||||
|
function(text)
|
||||||
|
return text .. "!!!"
|
||||||
|
end
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
default = {};
|
default = {};
|
||||||
|
@ -209,6 +220,7 @@ in {
|
||||||
color,
|
color,
|
||||||
padding,
|
padding,
|
||||||
extraConfig,
|
extraConfig,
|
||||||
|
fmt,
|
||||||
}:
|
}:
|
||||||
mergeAttrs
|
mergeAttrs
|
||||||
{
|
{
|
||||||
|
@ -217,7 +229,7 @@ in {
|
||||||
if isAttrs icon
|
if isAttrs icon
|
||||||
then removeAttrs (icon // {"__unkeyed" = icon.icon;}) ["icon"]
|
then removeAttrs (icon // {"__unkeyed" = icon.icon;}) ["icon"]
|
||||||
else icon;
|
else icon;
|
||||||
inherit icons_enabled separator color padding;
|
inherit icons_enabled separator color padding fmt;
|
||||||
}
|
}
|
||||||
extraConfig;
|
extraConfig;
|
||||||
processSections = mapAttrs (_: mapNullable (map processComponent));
|
processSections = mapAttrs (_: mapNullable (map processComponent));
|
||||||
|
|
|
@ -85,6 +85,11 @@
|
||||||
TelescopePrompt = "Telescope";
|
TelescopePrompt = "Telescope";
|
||||||
NvimTree = "NvimTree";
|
NvimTree = "NvimTree";
|
||||||
};
|
};
|
||||||
|
fmt = ''
|
||||||
|
function(value)
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
lualine_z = [
|
lualine_z = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue