Skip to content

Commit 90c3f24

Browse files
committed
plugins/colorful-menu: init
1 parent 380435c commit 90c3f24

File tree

2 files changed

+139
-0
lines changed

2 files changed

+139
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{ lib, ... }:
2+
lib.nixvim.plugins.mkNeovimPlugin {
3+
name = "colorful-menu";
4+
packPathName = "colorful-menu.nvim";
5+
package = "colorful-menu-nvim";
6+
7+
description = ''
8+
To use this in `nvim-cmp` for example,
9+
```nix
10+
plugins.cmp.settings.formatting.format.__raw = \'\'
11+
function(entry, vim_item)
12+
local highlights_info = require("colorful-menu").cmp_highlights(entry)
13+
14+
-- highlight_info is nil means we are missing the ts parser, it's
15+
-- better to fallback to use default `vim_item.abbr`. What this plugin
16+
-- offers is two fields: `vim_item.abbr_hl_group` and `vim_item.abbr`.
17+
if highlights_info ~= nil then
18+
vim_item.abbr_hl_group = highlights_info.highlights
19+
vim_item.abbr = highlights_info.text
20+
end
21+
22+
return vim_item
23+
end
24+
\'\';
25+
```
26+
27+
Learn more in the [README](https://github.com/xzbdmw/colorful-menu.nvim).
28+
'';
29+
30+
maintainers = [ lib.maintainers.GaetanLepage ];
31+
32+
settingsExample = {
33+
ls = {
34+
lua_ls.arguments_hl = "@comment";
35+
pyright.extra_info_hl = "@comment";
36+
fallback = true;
37+
};
38+
fallback_highlight = "@variable";
39+
max_width = 60;
40+
};
41+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
empty = {
3+
plugins.colorful-menu.enable = true;
4+
};
5+
6+
defaults = {
7+
plugins.colorful-menu = {
8+
enable = true;
9+
10+
settings = {
11+
ls = {
12+
lua_ls = {
13+
arguments_hl = "@comment";
14+
};
15+
gopls = {
16+
add_colon_before_type = false;
17+
align_type_to_right = true;
18+
preserve_type_when_truncate = true;
19+
};
20+
ts_ls = {
21+
extra_info_hl = "@comment";
22+
};
23+
vtsls = {
24+
extra_info_hl = "@comment";
25+
};
26+
zls = {
27+
align_type_to_right = true;
28+
};
29+
rust-analyzer = {
30+
extra_info_hl = "@comment";
31+
align_type_to_right = true;
32+
preserve_type_when_truncate = true;
33+
};
34+
clangd = {
35+
extra_info_hl = "@comment";
36+
import_dot_hl = "@comment";
37+
align_type_to_right = true;
38+
preserve_type_when_truncate = true;
39+
};
40+
roslyn = {
41+
extra_info_hl = "@comment";
42+
};
43+
basedpyright = {
44+
extra_info_hl = "@comment";
45+
};
46+
dartls = {
47+
extra_info_hl = "@comment";
48+
};
49+
fallback = true;
50+
fallback_extra_info_hl = "@comment";
51+
};
52+
fallback_highlight = "@variable";
53+
max_width = 60;
54+
};
55+
};
56+
};
57+
58+
withCmp = {
59+
plugins = {
60+
colorful-menu.enable = true;
61+
62+
cmp = {
63+
enable = true;
64+
settings.formatting.format.__raw = ''
65+
function(entry, vim_item)
66+
local highlights_info = require("colorful-menu").cmp_highlights(entry)
67+
68+
-- highlight_info is nil means we are missing the ts parser, it's
69+
-- better to fallback to use default `vim_item.abbr`. What this plugin
70+
-- offers is two fields: `vim_item.abbr_hl_group` and `vim_item.abbr`.
71+
if highlights_info ~= nil then
72+
vim_item.abbr_hl_group = highlights_info.highlights
73+
vim_item.abbr = highlights_info.text
74+
end
75+
76+
return vim_item
77+
end
78+
'';
79+
};
80+
};
81+
};
82+
83+
example = {
84+
plugins.colorful-menu = {
85+
enable = true;
86+
87+
settings = {
88+
ls = {
89+
lua_ls.arguments_hl = "@comment";
90+
pyright.extra_info_hl = "@comment";
91+
fallback = true;
92+
};
93+
fallback_highlight = "@variable";
94+
max_width = 60;
95+
};
96+
};
97+
};
98+
}

0 commit comments

Comments
 (0)