-
-
Notifications
You must be signed in to change notification settings - Fork 213
/
edgy.nix
317 lines (289 loc) · 8.38 KB
/
edgy.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
{
lib,
helpers,
config,
pkgs,
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "edgy";
originalName = "edgy.nvim";
defaultPackage = pkgs.vimPlugins.edgy-nvim;
maintainers = [ maintainers.GaetanLepage ];
extraConfig = cfg: {
# Those options are strongly recommended by the plugin author:
# https://github.com/folke/edgy.nvim?tab=readme-ov-file#-installation
opts = {
laststatus = mkDefault 3;
splitkeep = mkDefault "screen";
};
};
settingsOptions =
let
viewOpts = {
ft = helpers.mkNullOrStr ''
File type of the view.
'';
filter = helpers.mkNullOrLuaFn ''
Optional function to filter buffers and windows.
`fun(buf:buffer, win:window)`
'';
title = helpers.mkNullOrStr ''
Optional title of the view.
Defaults to the capitalized filetype.
'';
size = helpers.mkNullOrOption types.ints.unsigned ''
Size of the short edge of the edgebar.
For edgebars, this is the minimum width.
For panels, minimum height.
'';
pinned = helpers.mkNullOrOption types.bool ''
If true, the view will always be shown in the edgebar even when it has no windows.
'';
open = helpers.mkNullOrStr ''
Function or command to open a pinned view.
'';
wo = helpers.mkNullOrOption (with types; attrsOf anything) ''
View-specific window options.
'';
};
mkViewOptsOption =
name:
helpers.defaultNullOpts.mkListOf (
with types;
either str (submodule {
options = viewOpts;
})
) [ ] "List of the ${name} edgebar configurations.";
in
{
left = mkViewOptsOption "left";
bottom = mkViewOptsOption "bottom";
right = mkViewOptsOption "right";
top = mkViewOptsOption "top";
options =
mapAttrs
(_: defaultSize: {
size = helpers.defaultNullOpts.mkUnsignedInt defaultSize ''
Size of the short edge of the edgebar.
For edgebars, this is the minimum width.
For panels, minimum height.
'';
wo = helpers.mkNullOrOption (with types; attrsOf anything) ''
View-specific window options.
'';
})
{
left = 30;
bottom = 10;
right = 30;
top = 10;
};
animate = {
enabled = helpers.defaultNullOpts.mkBool true ''
Whether to enable animations.
'';
fps = helpers.defaultNullOpts.mkUnsignedInt 100 ''
Frames per second.
'';
cps = helpers.defaultNullOpts.mkUnsignedInt 120 ''
Cells per second.
'';
on_begin = helpers.defaultNullOpts.mkLuaFn ''
function()
vim.g.minianimate_disable = true
end
'' "Callback for the beginning of animations.";
on_end = helpers.defaultNullOpts.mkLuaFn ''
function()
vim.g.minianimate_disable = false
end
'' "Callback for the ending of animations.";
# This option accepts an attrs or a lua string.
# Hence, we convert the string to raw lua in `apply`.
spinner =
let
defaultFrames = [
"⠋"
"⠙"
"⠹"
"⠸"
"⠼"
"⠴"
"⠦"
"⠧"
"⠇"
"⠏"
];
in
helpers.mkNullOrOption' {
type =
with helpers.nixvimTypes;
either strLua (submodule {
freeformType = attrsOf anything;
options = {
frames = helpers.defaultNullOpts.mkListOf types.str defaultFrames ''
Frame characters.
'';
interval = helpers.defaultNullOpts.mkUnsignedInt 80 ''
Interval time between two consecutive frames.
'';
};
});
default = null;
example = "require('noice.util.spinners').spinners.circleFull";
apply = v: if isString v then helpers.mkRaw v else v;
description = "Spinner for pinned views that are loading.";
pluginDefault = {
frames = defaultFrames;
interval = 80;
};
};
};
exit_when_last = helpers.defaultNullOpts.mkBool false ''
Enable this to exit Neovim when only edgy windows are left.
'';
close_when_all_hidden = helpers.defaultNullOpts.mkBool true ''
Close edgy when all windows are hidden instead of opening one of them.
Disable to always keep at least one edgy split visible in each open section.
'';
wo = helpers.defaultNullOpts.mkAttrsOf types.anything {
winbar = true;
winfixwidth = true;
winfixheight = false;
winhighlight = "WinBar:EdgyWinBar,Normal:EdgyNormal";
spell = false;
signcolumn = "no";
} "Global window options for edgebar windows.";
# This option accepts an attrs or a lua string.
# Hence, we convert the string to raw lua in `apply`.
keys = helpers.defaultNullOpts.mkAttrsOf' {
type = with helpers.nixvimTypes; either strLuaFn (enum [ false ]);
apply = x: if x == null then null else mapAttrs (_: v: if isString v then helpers.mkRaw v else v) x;
description = ''
Buffer-local keymaps to be added to edgebar buffers.
Existing buffer-local keymaps will never be overridden.
Each value is either:
- A function declaration (as a raw lua string)
-> `fun(win:Edgy.Window)`
- `false` to disable this mapping.
'';
pluginDefault = {
q = ''
function(win)
win:close()
end
'';
"<c-q>" = ''
function(win)
win:hide()
end
'';
Q = ''
function(win)
win.view.edgebar:close()
end
'';
"]w" = ''
function(win)
win:next({ visible = true, focus = true })
end
'';
"[w" = ''
function(win)
win:prev({ visible = true, focus = true })
end
'';
"]W" = ''
function(win)
win:next({ pinned = false, focus = true })
end
'';
"[W" = ''
function(win)
win:prev({ pinned = false, focus = true })
end
'';
"<c-w>>" = ''
function(win)
win:resize("width", 2)
end
'';
"<c-w><lt>" = ''
function(win)
win:resize("width", -2)
end
'';
"<c-w>+" = ''
function(win)
win:resize("height", 2)
end
'';
"<c-w>-" = ''
function(win)
win:resize("height", -2)
end
'';
"<c-w>=" = ''
function(win)
win.view.edgebar:equalize()
end
'';
};
};
icons = {
closed = helpers.defaultNullOpts.mkStr " " ''
Icon for closed edgebars.
'';
open = helpers.defaultNullOpts.mkStr " " ''
Icon for opened edgebars.
'';
};
};
settingsExample = {
animate.enabled = false;
wo = {
winbar = false;
winfixwidth = false;
winfixheight = false;
winhighlight = "";
spell = false;
signcolumn = "no";
};
bottom = [
{
ft = "toggleterm";
size = 30;
filter = ''
function(buf, win)
return vim.api.nvim_win_get_config(win).relative == ""
end
'';
}
{
ft = "help";
size = 20;
filter = ''
function(buf)
return vim.bo[buf].buftype == "help"
end
'';
}
];
left = [
{
title = "nvimtree";
ft = "NvimTree";
size = 30;
}
{
ft = "Outline";
open = "SymbolsOutline";
}
{ ft = "dapui_scopes"; }
{ ft = "dapui_breakpoints"; }
{ ft = "dap-repl"; }
];
};
}