mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-27 02:59:00 +02:00
plugins/bufferline: fix deprecated highlight options (#313)
This commit is contained in:
parent
ca187c2262
commit
90d14f97d4
1 changed files with 116 additions and 139 deletions
|
@ -10,19 +10,109 @@ with lib; let
|
||||||
|
|
||||||
basePluginPath = ["plugins" "bufferline"];
|
basePluginPath = ["plugins" "bufferline"];
|
||||||
|
|
||||||
highlight = helpers.mkCompositeOption "Highlight option" {
|
highlightOption = {
|
||||||
guifg = helpers.mkNullOrOption types.str "foreground color";
|
fg = helpers.mkNullOrOption types.str "foreground color";
|
||||||
|
|
||||||
guibg = helpers.mkNullOrOption types.str "background color";
|
bg = helpers.mkNullOrOption types.str "background color";
|
||||||
|
|
||||||
|
sp = helpers.mkNullOrOption types.str "sp color";
|
||||||
|
|
||||||
|
bold = helpers.mkNullOrOption types.bool "enable bold";
|
||||||
|
|
||||||
|
italic = helpers.mkNullOrOption types.bool "enable italic";
|
||||||
|
};
|
||||||
|
|
||||||
|
highlightOptions = {
|
||||||
|
fill = "fill";
|
||||||
|
background = "background";
|
||||||
|
|
||||||
|
tab = "tab";
|
||||||
|
tab_selected = "tabSelected";
|
||||||
|
tab_close = "tabClose";
|
||||||
|
close_button = "closeButton";
|
||||||
|
close_button_visible = "closeButtonVisible";
|
||||||
|
close_button_selected = "closeButtonSelected";
|
||||||
|
|
||||||
|
buffer_visible = "bufferVisible";
|
||||||
|
buffer_selected = "bufferSelected";
|
||||||
|
|
||||||
|
diagnostic = "diagnostic";
|
||||||
|
diagnostic_visible = "diagnosticVisible";
|
||||||
|
diagnostic_selected = "diagnosticSelected";
|
||||||
|
|
||||||
|
info = "info";
|
||||||
|
info_visible = "infoVisible";
|
||||||
|
info_selected = "infoSelected";
|
||||||
|
|
||||||
|
info_diagnostic = "infoDiagnostic";
|
||||||
|
info_diagnostic_visible = "infoDiagnosticVisible";
|
||||||
|
info_diagnostic_selected = "infoDiagnosticSelected";
|
||||||
|
|
||||||
|
warning = "warning";
|
||||||
|
warning_visible = "warningVisible";
|
||||||
|
warning_selected = "warningSelected";
|
||||||
|
|
||||||
|
warning_diagnostic = "warningDiagnostic";
|
||||||
|
warning_diagnostic_visible = "warningDiagnosticVisible";
|
||||||
|
warning_diagnostic_selected = "warningDiagnosticSelected";
|
||||||
|
|
||||||
|
error = "error";
|
||||||
|
error_visible = "errorVisible";
|
||||||
|
error_selected = "errorSelected";
|
||||||
|
|
||||||
|
error_diagnostic = "errorDiagnostic";
|
||||||
|
error_diagnostic_visible = "errorDiagnosticVisible";
|
||||||
|
error_diagnostic_selected = "errorDiagnosticSelected";
|
||||||
|
|
||||||
|
modified = "modified";
|
||||||
|
modified_visible = "modifiedVisible";
|
||||||
|
modified_selected = "modifiedSelected";
|
||||||
|
|
||||||
|
duplicate = "duplicate";
|
||||||
|
duplicate_visible = "duplicateVisible";
|
||||||
|
duplicate_selected = "duplicateSelected";
|
||||||
|
|
||||||
|
separator = "separator";
|
||||||
|
separator_visible = "separatorVisible";
|
||||||
|
separator_selected = "separatorSelected";
|
||||||
|
|
||||||
|
indicator_selected = "indicatorSelected";
|
||||||
|
|
||||||
|
pick = "pick";
|
||||||
|
pick_visible = "pickVisible";
|
||||||
|
pick_selected = "pickSelected";
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports =
|
||||||
(
|
[
|
||||||
mkRenamedOptionModule
|
(
|
||||||
(basePluginPath ++ ["indicatorIcon"])
|
mkRenamedOptionModule
|
||||||
(basePluginPath ++ ["indicator" "icon"])
|
(basePluginPath ++ ["indicatorIcon"])
|
||||||
)
|
(basePluginPath ++ ["indicator" "icon"])
|
||||||
];
|
)
|
||||||
|
]
|
||||||
|
++ (
|
||||||
|
lists.flatten (
|
||||||
|
map (
|
||||||
|
highlightOptionName: let
|
||||||
|
prefix = basePluginPath ++ ["highlights" highlightOptionName];
|
||||||
|
in [
|
||||||
|
(
|
||||||
|
mkRenamedOptionModule
|
||||||
|
(prefix ++ ["guifg"])
|
||||||
|
(prefix ++ ["fg"])
|
||||||
|
)
|
||||||
|
(
|
||||||
|
mkRenamedOptionModule
|
||||||
|
(prefix ++ ["guibg"])
|
||||||
|
(prefix ++ ["bg"])
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
(attrValues highlightOptions)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
plugins.bufferline =
|
plugins.bufferline =
|
||||||
helpers.extraOptionsOptions
|
helpers.extraOptionsOptions
|
||||||
|
@ -79,7 +169,7 @@ in {
|
||||||
helpers.defaultNullOpts.mkStr "null"
|
helpers.defaultNullOpts.mkStr "null"
|
||||||
"Command or function run when middle clicking on a buffer.";
|
"Command or function run when middle clicking on a buffer.";
|
||||||
|
|
||||||
indicator = helpers.mkCompositeOption "Indicator" {
|
indicator = {
|
||||||
icon = helpers.defaultNullOpts.mkStr "▎" "icon";
|
icon = helpers.defaultNullOpts.mkStr "▎" "icon";
|
||||||
|
|
||||||
style = helpers.defaultNullOpts.mkEnumFirstDefault ["icon" "underline"] "style";
|
style = helpers.defaultNullOpts.mkEnumFirstDefault ["icon" "underline"] "style";
|
||||||
|
@ -194,74 +284,7 @@ in {
|
||||||
```
|
```
|
||||||
'';
|
'';
|
||||||
|
|
||||||
highlights =
|
highlights = genAttrs (attrValues highlightOptions) (name: highlightOption);
|
||||||
helpers.mkCompositeOption ""
|
|
||||||
(
|
|
||||||
genAttrs
|
|
||||||
[
|
|
||||||
"fill"
|
|
||||||
"background"
|
|
||||||
|
|
||||||
"tab"
|
|
||||||
|
|
||||||
"tabSelected"
|
|
||||||
"tabClose"
|
|
||||||
|
|
||||||
"closeButton"
|
|
||||||
"closeButtonVisible"
|
|
||||||
"closeButtonSelected"
|
|
||||||
|
|
||||||
"bufferVisible"
|
|
||||||
"bufferSelected"
|
|
||||||
|
|
||||||
"diagnostic"
|
|
||||||
"diagnosticVisible"
|
|
||||||
"diagnosticSelected"
|
|
||||||
|
|
||||||
"info"
|
|
||||||
"infoVisible"
|
|
||||||
"infoSelected"
|
|
||||||
|
|
||||||
"infoDiagnostic"
|
|
||||||
"infoDiagnosticVisible"
|
|
||||||
"infoDiagnosticSelected"
|
|
||||||
|
|
||||||
"warning"
|
|
||||||
"warningVisible"
|
|
||||||
"warningSelected"
|
|
||||||
|
|
||||||
"warningDiagnostic"
|
|
||||||
"warningDiagnosticVisible"
|
|
||||||
"warningDiagnosticSelected"
|
|
||||||
|
|
||||||
"error"
|
|
||||||
"errorVisible"
|
|
||||||
"errorSelected"
|
|
||||||
|
|
||||||
"errorDiagnostic"
|
|
||||||
"errorDiagnosticVisible"
|
|
||||||
"errorDiagnosticSelected"
|
|
||||||
|
|
||||||
"modified"
|
|
||||||
"modifiedVisible"
|
|
||||||
"modifiedSelected"
|
|
||||||
|
|
||||||
"duplicate"
|
|
||||||
"duplicateVisible"
|
|
||||||
"duplicateSelected"
|
|
||||||
|
|
||||||
"separator"
|
|
||||||
"separatorVisible"
|
|
||||||
"separatorSelected"
|
|
||||||
|
|
||||||
"indicatorSelected"
|
|
||||||
|
|
||||||
"pick"
|
|
||||||
"pickVisible"
|
|
||||||
"pickSelected"
|
|
||||||
]
|
|
||||||
(name: highlight)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -326,66 +349,20 @@ in {
|
||||||
}
|
}
|
||||||
// cfg.extraOptions;
|
// cfg.extraOptions;
|
||||||
|
|
||||||
highlights = with cfg.highlights;
|
highlights =
|
||||||
helpers.ifNonNull' cfg.highlights {
|
mapAttrs (
|
||||||
inherit fill background;
|
pluginOptionName: nixvimOptionName: {
|
||||||
|
inherit
|
||||||
inherit tab;
|
(cfg.highlights.${nixvimOptionName})
|
||||||
tab_selected = tabSelected;
|
fg
|
||||||
tab_close = tabClose;
|
bg
|
||||||
close_button = closeButton;
|
sp
|
||||||
close_button_visible = closeButtonVisible;
|
bold
|
||||||
close_button_selected = closeButtonSelected;
|
italic
|
||||||
|
;
|
||||||
buffer_visible = bufferVisible;
|
}
|
||||||
buffer_selected = bufferSelected;
|
)
|
||||||
|
highlightOptions;
|
||||||
inherit diagnostic;
|
|
||||||
diagnostic_visible = diagnosticVisible;
|
|
||||||
diagnostic_selected = diagnosticSelected;
|
|
||||||
|
|
||||||
inherit info;
|
|
||||||
info_visible = infoVisible;
|
|
||||||
info_selected = infoSelected;
|
|
||||||
|
|
||||||
info_diagnostic = infoDiagnostic;
|
|
||||||
info_diagnostic_visible = infoDiagnosticVisible;
|
|
||||||
info_diagnostic_selected = infoDiagnosticSelected;
|
|
||||||
|
|
||||||
inherit warning;
|
|
||||||
warning_visible = warningVisible;
|
|
||||||
warning_selected = warningSelected;
|
|
||||||
|
|
||||||
warning_diagnostic = warningDiagnostic;
|
|
||||||
warning_diagnostic_visible = warningDiagnosticVisible;
|
|
||||||
warning_diagnostic_selected = warningDiagnosticSelected;
|
|
||||||
|
|
||||||
inherit error;
|
|
||||||
error_visible = errorVisible;
|
|
||||||
error_selected = errorSelected;
|
|
||||||
|
|
||||||
error_diagnostic = errorDiagnostic;
|
|
||||||
error_diagnostic_visible = errorDiagnosticVisible;
|
|
||||||
error_diagnostic_selected = errorDiagnosticSelected;
|
|
||||||
|
|
||||||
inherit modified;
|
|
||||||
modified_visible = modifiedVisible;
|
|
||||||
modified_selected = modifiedSelected;
|
|
||||||
|
|
||||||
inherit duplicate;
|
|
||||||
duplicate_visible = duplicateVisible;
|
|
||||||
duplicate_selected = duplicateSelected;
|
|
||||||
|
|
||||||
inherit separator;
|
|
||||||
separator_visible = separatorVisible;
|
|
||||||
separator_selected = separatorSelected;
|
|
||||||
|
|
||||||
indicator_selected = indicatorSelected;
|
|
||||||
|
|
||||||
inherit pick;
|
|
||||||
pick_visible = pickVisible;
|
|
||||||
pick_selected = pickSelected;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue