-
-
Notifications
You must be signed in to change notification settings - Fork 213
/
navic.nix
122 lines (109 loc) · 3.32 KB
/
navic.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
{
lib,
helpers,
config,
pkgs,
...
}:
with lib;
let
cfg = config.plugins.navic;
in
{
options.plugins.navic = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "nvim-navic";
package = helpers.mkPluginPackageOption "nvim-navic" pkgs.vimPlugins.nvim-navic;
icons = 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 = " ";
};
lsp = {
autoAttach = helpers.defaultNullOpts.mkBool false ''
Enable to have nvim-navic automatically attach to every LSP for current buffer. Its disabled by default.
'';
preference = helpers.defaultNullOpts.mkListOf' {
type = types.str;
pluginDefault = [ ];
example = [
"clangd"
"pyright"
];
description = ''
Table ranking lsp_servers. Lower the index, higher the priority of the server. If there are more than one server attached to a buffer. In the example below will prefer clangd over pyright
'';
};
};
highlight = helpers.defaultNullOpts.mkBool false ''
If set to true, will add colors to icons and text as defined by highlight groups NavicIcons* (NavicIconsFile, NavicIconsModule.. etc.), NavicText and NavicSeparator.
'';
separator = helpers.defaultNullOpts.mkStr " > " ''
Icon to separate items. to use between items.
'';
depthLimit = helpers.defaultNullOpts.mkInt 0 ''
Maximum depth of context to be shown. If the context hits this depth limit, it is truncated.
'';
depthLimitIndicator = helpers.defaultNullOpts.mkStr ".." ''
Icon to indicate that depth_limit was hit and the shown context is truncated.
'';
safeOutput = helpers.defaultNullOpts.mkBool true ''
Sanitize the output for use in statusline and winbar.
'';
lazyUpdateContext = helpers.defaultNullOpts.mkBool false ''
If true, turns off context updates for the "CursorMoved" event.
'';
click = helpers.defaultNullOpts.mkBool false ''
Single click to goto element, double click to open nvim-navbuddy on the clicked element.
'';
};
config =
let
setupOptions =
with cfg;
{
inherit
icons
highlight
separator
click
;
lsp = with lsp; {
auto_attach = autoAttach;
inherit preference;
};
depth_limit = depthLimit;
safe_output = safeOutput;
lazy_update_context = lazyUpdateContext;
}
// cfg.extraOptions;
in
mkIf cfg.enable {
extraPlugins = [ cfg.package ];
extraConfigLua = ''
require('nvim-navic').setup(${helpers.toLuaObject setupOptions})
'';
};
}