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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
|
{
config,
lib,
...
}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) int bool str listOf enum nullOr anything;
inherit (lib.nvim.types) mkPluginSetupOption borderType;
inherit (lib.generators) mkLuaInline;
inherit (config.vim.lib) mkMappingOption;
in {
options.vim.statusline.lualine = {
enable = mkEnableOption "lualine statusline plugin";
setupOpts = mkPluginSetupOption "Lualine" {
sections = {
lualine_a = mkOption {
type = listOf anything;
description = "active config for: | (A) | B | C X | Y | Z |";
default = [
{
"@1" = "mode";
icons_enabled = true;
separator = {
left = "▎";
right = "";
};
}
{
"@1" = "";
draw_empty = true;
separator = {
left = "";
right = "";
};
}
];
};
lualine_b = mkOption {
type = listOf anything;
description = "active config for: | A | (B) | C X | Y | Z |";
default = [
{
"@1" = "filetype";
colored = true;
icon_only = true;
icon = {align = "left";};
}
{
"@1" = "filename";
symbols = {
modified = " ";
readonly = " ";
};
separator = {right = "";};
}
{
"@1" = "";
draw_empty = true;
separator = {
left = "";
right = "";
};
}
];
};
lualine_c = mkOption {
type = listOf anything;
description = "active config for: | A | B | (C) X | Y | Z |";
default = [
{
"@1" = "diff";
colored = false;
diff_color = {
added = "DiffAdd";
modified = "DiffChange";
removed = "DiffDelete";
};
symbols = {
added = "+";
modified = "~";
removed = "-";
};
separator = {right = "";};
}
];
};
lualine_x = mkOption {
type = listOf anything;
description = "active config for: | A | B | C (X) | Y | Z |";
default = [
(mkLuaInline ''
{
-- Lsp server name
function()
local buf_ft = vim.bo.filetype
local excluded_buf_ft = { toggleterm = true, NvimTree = true, ["neo-tree"] = true, TelescopePrompt = true }
if excluded_buf_ft[buf_ft] then
return ""
end
local bufnr = vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients({ bufnr = bufnr })
if vim.tbl_isempty(clients) then
return "No Active LSP"
end
local active_clients = {}
for _, client in ipairs(clients) do
table.insert(active_clients, client.name)
end
return table.concat(active_clients, ", ")
end,
icon = " ",
separator = {left = ""},
}
'')
{
"@1" = "diagnostics";
sources = ["nvim_lsp" "nvim_diagnostic" "vim_lsp" "coc"];
symbols = {
error = " ";
warn = " ";
info = " ";
hint = " ";
};
colored = true;
update_in_insert = false;
always_visible = false;
diagnostics_color = {
color_error = {fg = "red";};
color_warn = {fg = "yellow";};
color_info = {fg = "cyan";};
};
}
];
};
lualine_y = mkOption {
type = listOf anything;
description = "active config for: | A | B | C X | (Y) | Z |";
default = [
{
"@1" = "";
draw_empty = true;
separator = {
left = "";
right = "";
};
}
{
"@1" = "t";
maxcount = 999;
timeout = 120;
separator = {left = "";};
}
{
"@1" = "branch";
icon = "•";
separator = {left = "";};
}
];
};
lualine_z = mkOption {
type = listOf anything;
description = "active config for: | A | B | C X | Y | (Z) |";
default = [
{
"@1" = "";
draw_empty = true;
separator = {
left = "";
right = "";
};
}
{
"@1" = "progress";
separator = {left = "";};
}
["location"]
{
"@1" = "fileformat";
color = {fg = "black";};
symbols = {
unix = "";
dos = "";
mac = "";
};
}
];
};
};
inactive_sections = {
lualine_a = mkOption {
type = listOf anything;
description = "inactive config for: | (A) | B | C X | Y | Z |";
default = [];
};
lualine_b = mkOption {
type = listOf anything;
description = "inactive config for: | A | (B) | C X | Y | Z |";
default = [];
};
lualine_c = mkOption {
type = listOf anything;
description = "inactive config for: | A | B | (C) X | Y | Z |";
default = ["filename"];
};
lualine_x = mkOption {
type = listOf anything;
description = "inactive config for: | A | B | C (X) | Y | Z |";
default = ["location"];
};
lualine_y = mkOption {
type = listOf anything;
description = "inactive config for: | A | B | C X | (Y) | Z |";
default = [];
};
lualine_z = mkOption {
type = listOf anything;
description = "inactive config for: | A | B | C X | Y | (Z) |";
default = [];
};
};
};
integrations = {
breadcrumbs = {
location = mkOption {
type = enum ["statusline" "winbar"];
apply = value:
{
statusline = "sections";
winbar = "winbar";
}."${value}";
default = "statusline";
description = ''
Where the breadcrumbs should appear
'';
};
section = mkOption {
type = enum ["a" "b" "c" "x" "y" "z"];
default = "c";
description = ''
Which lualine section to occupy for the breadcrumbs feature.
'';
};
vanilla = {
enable = mkEnableOption "vanilla breadcrumbs";
separator = {
symbol = mkOption {
type = str;
default = ".";
description = "Symbol to use for each breadcrumb entry";
example = " > ";
};
color = mkOption {
type = str;
default = "@keyword";
description = "Color to use for each breadcrumb symbol";
};
};
};
nvim-navic = {
enable = mkEnableOption "nvim-navic";
alwaysRender = mkOption {
type = bool;
default = true;
description = ''
This will pass `draw_empty` to the `nvim_navic` winbar
component, which causes the component to be drawn even
if it's empty.
'';
};
};
navbuddy = let
mkSimpleIconOption = default:
mkOption {
inherit default;
type = str;
description = "";
};
in {
enable = mkEnableOption "navbuddy LSP helper UI. Enabling this option automatically loads and enables nvim-navic";
mappings = {
close = mkMappingOption "Close and return the cursor to its original location." "<esc>";
nextSibling = mkMappingOption "Navigate to the next sibling node." "j";
previousSibling = mkMappingOption "Navigate to the previous sibling node." "k";
parent = mkMappingOption "Navigate to the parent node." "h";
children = mkMappingOption "Navigate to the child node." "l";
root = mkMappingOption "Navigate to the root node." "0";
visualName = mkMappingOption "Select the name visually." "v";
visualScope = mkMappingOption "Select the scope visually." "V";
yankName = mkMappingOption "Yank the name to system clipboard." "y";
yankScope = mkMappingOption "Yank the scope to system clipboard." "Y";
insertName = mkMappingOption "Insert at the start of name." "i";
insertScope = mkMappingOption "Insert at the start of scope." "I";
appendName = mkMappingOption "Insert at the end of name." "a";
appendScope = mkMappingOption "Insert at the end of scope." "A";
rename = mkMappingOption "Rename the node." "r";
delete = mkMappingOption "Delete the node." "d";
foldCreate = mkMappingOption "Create a new fold of the node." "f";
foldDelete = mkMappingOption "Delete the current fold of the node." "F";
comment = mkMappingOption "Comment the node." "c";
select = mkMappingOption "Goto the node." "<enter>";
moveDown = mkMappingOption "Move the node down." "J";
moveUp = mkMappingOption "Move the node up." "K";
togglePreview = mkMappingOption "Toggle the preview." "s";
vsplit = mkMappingOption "Open the node in a vertical split." "<C-v>";
hsplit = mkMappingOption "Open the node in a horizontal split." "<C-s>";
telescope = mkMappingOption "Start fuzzy finder at the current level." "t";
help = mkMappingOption "Open the mappings help window." "g?";
};
setupOpts = mkPluginSetupOption "navbuddy" {
useDefaultMappings = mkOption {
type = bool;
default = true;
description = "Add the default Navbuddy keybindings in addition to the keybinding added by this module.";
};
window = {
# size = {}
# position = {}
border = mkOption {
type = borderType;
default = config.vim.ui.borders.globalStyle;
description = "The border style to use.";
};
scrolloff = mkOption {
type = nullOr int;
default = null;
description = "The scrolloff value within a navbuddy window.";
};
sections = {
# left section
left = {
/*
size = mkOption {
type = nullOr (intBetween 0 100);
default = null;
description = "size of the left section of Navbuddy UI in percentage (0-100)";
};
*/
border = mkOption {
type = borderType;
default = config.vim.ui.borders.globalStyle;
description = "The border style to use for the left section of the Navbuddy UI.";
};
};
# middle section
mid = {
/*
size = {
type = nullOr (intBetween 0 100);
default = null;
description = "size of the left section of Navbuddy UI in percentage (0-100)";
};
*/
border = mkOption {
type = borderType;
default = config.vim.ui.borders.globalStyle;
description = "The border style to use for the middle section of the Navbuddy UI.";
};
};
# right section
# there is no size option for the right section, it fills the remaining space
right = {
border = mkOption {
type = borderType;
default = config.vim.ui.borders.globalStyle;
description = "The border style to use for the right section of the Navbuddy UI.";
};
preview = mkOption {
type = enum ["leaf" "always" "never"];
default = "leaf";
description = "The display mode of the preview on the right section.";
};
};
};
};
node_markers = {
enable = mkEnableOption "node markers";
icons = {
leaf = mkSimpleIconOption " ";
leaf_selected = mkSimpleIconOption " → ";
branch = mkSimpleIconOption " ";
};
};
lsp = {
auto_attach = mkOption {
type = bool;
default = true;
description = "Whether to attach to LSP server manually.";
};
preference = mkOption {
type = nullOr (listOf str);
default = null;
description = "The preference list ranking LSP servers.";
};
};
source_buffer = {
followNode = mkOption {
type = bool;
default = true;
description = "Whether to keep the current node in focus in the source buffer.";
};
highlight = mkOption {
type = bool;
default = true;
description = "Whether to highlight the currently focused node in the source buffer.";
};
reorient = mkOption {
type = enum ["smart" "top" "mid" "none"];
default = "smart";
description = "The mode for reorienting the source buffer after moving nodes.";
};
scrolloff = mkOption {
type = nullOr int;
default = null;
description = "The scrolloff value in the source buffer when Navbuddy is open.";
};
};
icons = {
File = mkSimpleIconOption " ";
Module = mkSimpleIconOption " ";
Namespace = mkSimpleIconOption " ";
Package = mkSimpleIconOption " ";
Class = mkSimpleIconOption " ";
Property = mkSimpleIconOption " ";
Field = mkSimpleIconOption " ";
Constructor = mkSimpleIconOption " ";
Enum = mkSimpleIconOption "";
Interface = mkSimpleIconOption "";
Function = mkSimpleIconOption " ";
Variable = mkSimpleIconOption " ";
Constant = mkSimpleIconOption " ";
String = mkSimpleIconOption " ";
Number = mkSimpleIconOption " ";
Boolean = mkSimpleIconOption "◩ ";
Array = mkSimpleIconOption " ";
Object = mkSimpleIconOption " ";
Method = mkSimpleIconOption " ";
Key = mkSimpleIconOption " ";
Null = mkSimpleIconOption " ";
EnumMember = mkSimpleIconOption " ";
Struct = mkSimpleIconOption " ";
Event = mkSimpleIconOption " ";
Operator = mkSimpleIconOption " ";
TypeParameter = mkSimpleIconOption " ";
};
};
};
lspsaga = {
enable = mkEnableOption "lspsaga breadcrumbs";
};
};
};
};
}
|