2023-02-20 11:42:13 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
2022-09-18 11:19:23 +01:00
|
|
|
cfg = config.plugins.airline;
|
2023-02-20 11:42:13 +01:00
|
|
|
helpers = import ../helpers.nix {inherit lib;};
|
2021-01-05 11:26:49 +00:00
|
|
|
|
2023-02-20 11:42:13 +01:00
|
|
|
sectionType = with types; nullOr (oneOf [str (listOf str)]);
|
2021-01-05 11:26:49 +00:00
|
|
|
sectionOption = mkOption {
|
|
|
|
default = null;
|
|
|
|
type = sectionType;
|
|
|
|
description = "Configuration for this section. Can be either a statusline-format string or a list of modules to be passed to airline#section#create_*.";
|
|
|
|
};
|
2023-02-20 11:42:13 +01:00
|
|
|
in {
|
2021-01-05 11:26:49 +00:00
|
|
|
options = {
|
2022-09-18 11:19:23 +01:00
|
|
|
plugins.airline = {
|
2023-01-22 03:32:08 +00:00
|
|
|
enable = mkEnableOption "airline";
|
2021-01-05 11:26:49 +00:00
|
|
|
|
2023-01-25 19:46:49 +01:00
|
|
|
package = helpers.mkPackageOption "airline" pkgs.vimPlugins.vim-airline;
|
2023-01-19 10:45:15 +00:00
|
|
|
|
2021-01-05 11:26:49 +00:00
|
|
|
extensions = mkOption {
|
|
|
|
default = null;
|
|
|
|
type = with types; nullOr attrs;
|
|
|
|
description = "A list of extensions and their configuration";
|
|
|
|
};
|
|
|
|
|
|
|
|
onTop = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = "Whether to show the statusline on the top instead of the bottom";
|
|
|
|
};
|
|
|
|
|
|
|
|
sections = mkOption {
|
2022-01-12 12:42:12 +00:00
|
|
|
description = "Statusbar sections";
|
2021-01-05 11:26:49 +00:00
|
|
|
default = null;
|
2023-02-20 11:42:13 +01:00
|
|
|
type = with types;
|
|
|
|
nullOr (submodule {
|
|
|
|
options = {
|
|
|
|
a = sectionOption;
|
|
|
|
b = sectionOption;
|
|
|
|
c = sectionOption;
|
|
|
|
x = sectionOption;
|
|
|
|
y = sectionOption;
|
|
|
|
z = sectionOption;
|
|
|
|
};
|
|
|
|
});
|
2021-01-05 11:26:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
powerline = mkOption {
|
2022-04-22 11:22:31 +01:00
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
2021-01-05 11:26:49 +00:00
|
|
|
description = "Whether to use powerline symbols";
|
|
|
|
};
|
|
|
|
|
|
|
|
theme = mkOption {
|
2022-09-18 11:19:23 +01:00
|
|
|
default = config.colorscheme;
|
2021-01-05 11:26:49 +00:00
|
|
|
type = with types; nullOr str;
|
|
|
|
description = "The theme to use for vim-airline. If set, vim-airline-themes will be installed.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-02-20 11:42:13 +01:00
|
|
|
config = let
|
|
|
|
sections = {};
|
|
|
|
in
|
2022-09-18 11:19:23 +01:00
|
|
|
mkIf cfg.enable {
|
2023-02-20 11:42:13 +01:00
|
|
|
extraPlugins = with pkgs.vimPlugins;
|
|
|
|
[
|
|
|
|
cfg.package
|
|
|
|
]
|
2023-05-22 15:45:47 +05:30
|
|
|
++ optional (cfg.theme != null) vim-airline-themes;
|
2023-02-20 11:42:13 +01:00
|
|
|
globals =
|
|
|
|
{
|
|
|
|
airline.extensions = cfg.extensions;
|
2021-01-05 11:26:49 +00:00
|
|
|
|
2023-02-20 11:42:13 +01:00
|
|
|
airline_statusline_ontop = mkIf cfg.onTop 1;
|
2023-05-22 15:45:47 +05:30
|
|
|
airline_powerline_fonts = mkIf cfg.powerline 1;
|
2021-01-05 11:26:49 +00:00
|
|
|
|
2023-05-22 15:45:47 +05:30
|
|
|
airline_theme = mkIf (cfg.theme != null) cfg.theme;
|
2023-02-20 11:42:13 +01:00
|
|
|
}
|
|
|
|
// sections;
|
2021-01-05 11:26:49 +00:00
|
|
|
};
|
|
|
|
}
|