mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-10 01:04:34 +02:00
plugins: remove mkCompositeOptions from implementation
This commit is contained in:
parent
70b4e2d981
commit
d8cffe2ead
13 changed files with 607 additions and 681 deletions
|
@ -11,12 +11,10 @@ with lib; let
|
|||
mkSeparatorsOption = {
|
||||
leftDefault ? " ",
|
||||
rightDefault ? " ",
|
||||
name,
|
||||
}:
|
||||
helpers.mkCompositeOption "${name} separtors." {
|
||||
left = helpers.defaultNullOpts.mkStr leftDefault "Left separator";
|
||||
right = helpers.defaultNullOpts.mkStr rightDefault "Right separator";
|
||||
};
|
||||
}: {
|
||||
left = helpers.defaultNullOpts.mkStr leftDefault "Left separator";
|
||||
right = helpers.defaultNullOpts.mkStr rightDefault "Right separator";
|
||||
};
|
||||
|
||||
mkComponentOptions = defaultName:
|
||||
helpers.mkNullOrOption
|
||||
|
@ -55,7 +53,7 @@ with lib; let
|
|||
)
|
||||
"Defines the icon to be displayed in front of the component.";
|
||||
|
||||
separator = mkSeparatorsOption {name = "Component";};
|
||||
separator = mkSeparatorsOption {};
|
||||
|
||||
color = helpers.mkNullOrOption (types.attrsOf types.str) ''
|
||||
Defines a custom color for the component.
|
||||
|
@ -92,15 +90,14 @@ with lib; let
|
|||
))
|
||||
"";
|
||||
|
||||
mkEmptySectionOption = name:
|
||||
helpers.mkCompositeOption name {
|
||||
lualine_a = mkComponentOptions "";
|
||||
lualine_b = mkComponentOptions "";
|
||||
lualine_c = mkComponentOptions "";
|
||||
lualine_x = mkComponentOptions "";
|
||||
lualine_y = mkComponentOptions "";
|
||||
lualine_z = mkComponentOptions "";
|
||||
};
|
||||
mkEmptySectionOption = name: {
|
||||
lualine_a = mkComponentOptions "";
|
||||
lualine_b = mkComponentOptions "";
|
||||
lualine_c = mkComponentOptions "";
|
||||
lualine_x = mkComponentOptions "";
|
||||
lualine_y = mkComponentOptions "";
|
||||
lualine_z = mkComponentOptions "";
|
||||
};
|
||||
in {
|
||||
options = {
|
||||
plugins.lualine = {
|
||||
|
@ -119,16 +116,14 @@ in {
|
|||
componentSeparators = mkSeparatorsOption {
|
||||
leftDefault = "";
|
||||
rightDefault = "";
|
||||
name = "component";
|
||||
};
|
||||
|
||||
sectionSeparators = mkSeparatorsOption {
|
||||
leftDefault = "";
|
||||
rightDefault = "";
|
||||
name = "section";
|
||||
};
|
||||
|
||||
disabledFiletypes = helpers.mkCompositeOption "Filetypes to disable lualine for." {
|
||||
disabledFiletypes = {
|
||||
statusline = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]" ''
|
||||
Only ignores the ft for statusline.
|
||||
'';
|
||||
|
@ -157,23 +152,15 @@ in {
|
|||
This feature is only available in neovim 0.7 and higher.
|
||||
'';
|
||||
|
||||
refresh =
|
||||
helpers.mkCompositeOption
|
||||
''
|
||||
Sets how often lualine should refresh it's contents (in ms).
|
||||
The refresh option sets minimum time that lualine tries to maintain between refresh.
|
||||
It's not guarantied if situation arises that lualine needs to refresh itself before this
|
||||
time it'll do it.
|
||||
''
|
||||
{
|
||||
statusline = helpers.defaultNullOpts.mkInt 1000 "Refresh time for the status line (ms)";
|
||||
refresh = {
|
||||
statusline = helpers.defaultNullOpts.mkInt 1000 "Refresh time for the status line (ms)";
|
||||
|
||||
tabline = helpers.defaultNullOpts.mkInt 1000 "Refresh time for the tabline (ms)";
|
||||
tabline = helpers.defaultNullOpts.mkInt 1000 "Refresh time for the tabline (ms)";
|
||||
|
||||
winbar = helpers.defaultNullOpts.mkInt 1000 "Refresh time for the winbar (ms)";
|
||||
};
|
||||
winbar = helpers.defaultNullOpts.mkInt 1000 "Refresh time for the winbar (ms)";
|
||||
};
|
||||
|
||||
sections = helpers.mkCompositeOption "Sections configuration" {
|
||||
sections = {
|
||||
lualine_a = mkComponentOptions "mode";
|
||||
lualine_b = mkComponentOptions "branch";
|
||||
lualine_c = mkComponentOptions "filename";
|
||||
|
@ -183,7 +170,7 @@ in {
|
|||
lualine_z = mkComponentOptions "location";
|
||||
};
|
||||
|
||||
inactiveSections = helpers.mkCompositeOption "Inactive Sections configuration" {
|
||||
inactiveSections = {
|
||||
lualine_a = mkComponentOptions "";
|
||||
lualine_b = mkComponentOptions "";
|
||||
lualine_c = mkComponentOptions "filename";
|
||||
|
@ -245,11 +232,11 @@ in {
|
|||
always_divide_middle = cfg.alwaysDivideMiddle;
|
||||
};
|
||||
|
||||
sections = mapNullable processSections cfg.sections;
|
||||
inactive_sections = mapNullable processSections cfg.inactiveSections;
|
||||
tabline = mapNullable processSections cfg.tabline;
|
||||
winbar = mapNullable processSections cfg.winbar;
|
||||
inactive_winbar = mapNullable processSections cfg.inactiveWinbar;
|
||||
sections = processSections cfg.sections;
|
||||
inactive_sections = processSections cfg.inactiveSections;
|
||||
tabline = processSections cfg.tabline;
|
||||
winbar = processSections cfg.winbar;
|
||||
inactive_winbar = processSections cfg.inactiveWinbar;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue