/
airline.nix
76 lines (67 loc) · 2.12 KB
/
airline.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.airline;
helpers = import ../helpers.nix { inherit lib; };
sectionType = with types; nullOr (oneOf [ str (listOf str)]);
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_*.";
};
in {
options = {
programs.nixvim.plugins.airline = {
enable = mkEnableOption "Enable airline";
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 {
description = "Statusbar sections";
default = null;
type = with types; nullOr (submodule {
options = {
a = sectionOption;
b = sectionOption;
c = sectionOption;
x = sectionOption;
y = sectionOption;
z = sectionOption;
};
});
};
powerline = mkOption {
default = null;
type = with types; nullOr bool;
description = "Whether to use powerline symbols";
};
theme = mkOption {
default = config.programs.nixvim.colorscheme;
type = with types; nullOr str;
description = "The theme to use for vim-airline. If set, vim-airline-themes will be installed.";
};
};
};
config = let
sections = {};
in mkIf cfg.enable {
programs.nixvim = {
extraPlugins = with pkgs.vimPlugins; [
vim-airline
] ++ optional (!isNull cfg.theme) vim-airline-themes;
globals = {
airline.extensions = cfg.extensions;
airline_statusline_ontop = mkIf cfg.onTop 1;
airline_powerline_fonts = mkIf (cfg.powerline) 1;
airline_theme = mkIf (!isNull cfg.theme) cfg.theme;
} // sections;
};
};
}