-
-
Notifications
You must be signed in to change notification settings - Fork 213
/
barbecue.nix
194 lines (170 loc) · 4.8 KB
/
barbecue.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
{
lib,
helpers,
config,
pkgs,
...
}:
with lib;
let
cfg = config.plugins.barbecue;
mkListStr = helpers.defaultNullOpts.mkNullable (types.listOf types.str);
in
{
options.plugins.barbecue = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "barbecue-nvim";
package = helpers.mkPluginPackageOption "barbecue-nvim" pkgs.vimPlugins.barbecue-nvim;
attachNavic = helpers.defaultNullOpts.mkBool true ''
Whether to attach navic to language servers automatically.
'';
createAutocmd = helpers.defaultNullOpts.mkBool true ''
Whether to create winbar updater autocmd.
'';
includeBuftypes = mkListStr [ "" ] ''
Buftypes to enable winbar in.
'';
excludeFiletypes =
mkListStr
[
"netrw"
"toggleterm"
]
''
Filetypes not to enable winbar in.
'';
modifiers = {
dirname = helpers.defaultNullOpts.mkStr ":~:." ''
Filename modifiers applied to dirname.
See: `:help filename-modifiers`
'';
basename = helpers.defaultNullOpts.mkStr "" ''
Filename modifiers applied to basename.
See: `:help filename-modifiers`
'';
};
showDirname = helpers.defaultNullOpts.mkBool true ''
Whether to display path to file.
'';
showBasename = helpers.defaultNullOpts.mkBool true ''
Whether to display file name.
'';
showModified = helpers.defaultNullOpts.mkBool false ''
Whether to replace file icon with the modified symbol when buffer is modified.
'';
modified =
helpers.defaultNullOpts.mkLuaFn
''
function(bufnr)
return vim.bo[bufnr].modified
end
''
''
Get modified status of file.
NOTE: This can be used to get file modified status from SCM (e.g. git)
'';
showNavic = helpers.defaultNullOpts.mkBool true ''
Whether to show/use navic in the winbar.
'';
leadCustomSection =
helpers.defaultNullOpts.mkLuaFn
''
function()
return " "
end
''
''
Get leading custom section contents.
NOTE: This function shouldn't do any expensive actions as it is run on each render.
'';
customSection =
helpers.defaultNullOpts.mkLuaFn
''
function()
return " "
end
''
''
Get custom section contents.
NOTE: This function shouldn't do any expensive actions as it is run on each render.
'';
theme = helpers.defaultNullOpts.mkStr "auto" ''
Theme to be used for generating highlight groups dynamically.
'';
contextFollowIconColor = helpers.defaultNullOpts.mkBool false ''
Whether context text should follow its icon's color.
'';
symbols = {
modified = helpers.defaultNullOpts.mkStr "●" ''
Modification indicator.
'';
ellipsis = helpers.defaultNullOpts.mkStr "…" ''
Truncation indicator.
'';
separator = helpers.defaultNullOpts.mkStr "" ''
Entry separator.
'';
};
kinds = mapAttrs (name: default: helpers.defaultNullOpts.mkStr default "icon for ${name}.") {
File = "";
Module = "";
Namespace = "";
Package = "";
Class = "";
Method = "";
Property = "";
Field = "";
Constructor = "";
Enum = "";
Interface = "";
Function = "";
Variable = "";
Constant = "";
String = "";
Number = "";
Boolean = "";
Array = "";
Object = "";
Key = "";
Null = "";
EnumMember = "";
Struct = "";
Event = "";
Operator = "";
TypeParameter = "";
};
};
config =
let
setupOptions =
with cfg;
{
attach_navic = attachNavic;
create_autocmd = createAutocmd;
include_buftypes = includeBuftypes;
exclude_filetypes = excludeFiletypes;
modifiers = {
inherit (modifiers) dirname basename;
};
show_dirname = showDirname;
show_basename = showBasename;
show_modified = showModified;
inherit modified;
show_navic = showNavic;
lead_custom_section = leadCustomSection;
custom_section = customSection;
inherit theme;
context_follow_icon_color = contextFollowIconColor;
symbols = {
inherit (symbols) modified ellipsis separator;
};
inherit kinds;
}
// cfg.extraOptions;
in
mkIf cfg.enable {
extraPlugins = [ cfg.package ];
extraConfigLua = ''
require('barbecue').setup(${helpers.toLuaObject setupOptions})
'';
};
}