1{ pkgs, ... } @ inputs:
2
3let
4 inherit (import ../../lib/colors.nix inputs) colors mkNeovimHighlights;
5
6 highlights = with colors; mkNeovimHighlights {
7 # Highlighting Groups (descriptions and ordering from `:h hitest.vim`)
8 ColorColumn.bg = cursor;
9 Conceal.force = true;
10 Cursor = { fg = black; bg = blue; };
11 CursorIM.force = true;
12 CursorColumn.bg = cursor;
13 CursorLine.bg = gutter;
14 Directory.fg = blue;
15 ErrorMsg.fg = brightRed;
16 WarningMsg.fg = yellow;
17 VertSplit.fg = split;
18 Folded = { bg = gutter; fg = muted; };
19 FoldColumn.force = true;
20 SignColumn.force = true;
21 Search = { fg = blue; reverse = true; };
22 LineNr = { fg = black; bg = black; };
23 CursorLineNr = { fg = muted; bg = gutter; bold = true; };
24 MatchParen = { fg = blue; underline = true; };
25 ModeMsg.force = true;
26 MoreMsg.force = true;
27 NonText.fg = grey;
28 Normal.fg = white;
29 Question.fg = magenta;
30 SpecialKey.fg = grey;
31
32 StatusLine = { fg = white; };
33 StatusLineNC.fg = muted;
34 Title.fg = green;
35 Visual.bg = cursor;
36 VisualNOS.fg = grey;
37 WildMenu = { fg = black; bg = blue; };
38 NormalFloat.bg = element;
39 TreesitterContext.bg = gutter;
40
41 WinSeparator.fg = split;
42 FloatBorder.link = "WinSeparator";
43
44 Diff = {
45 Add.bg = gutter;
46 Change.bg = gutter;
47 Delete.fg = muted;
48 Text.force = true;
49 };
50
51 Pmenu = {
52 base = { bg = gutter; blend = 5; };
53 Sel = { fg = black; bg = blue; };
54 Sbar.force = true;
55 Thumb.bg = cursor;
56 };
57
58 Spell = {
59 Bad = { sp = brightRed; undercurl = true; };
60 Cap.fg = orange;
61 Local.fg = orange;
62 Rare.fg = orange;
63 };
64
65 TabLine = {
66 base.fg = muted;
67 Fill.force = true;
68 Sel.fg = white;
69 };
70
71 GitSigns = {
72 Add.fg = green;
73 Change.fg = blue;
74 Delete.fg = brightRed;
75 Changedelete.strikethrough = true;
76 Topdelete.link = "GitSignsDelete";
77 };
78
79 Diagnostic = {
80 Warn.fg = yellow;
81 Error.fg = brightRed;
82 Info.fg = blue;
83 Hint.fg = yellow;
84 Ok.fg = green;
85 };
86
87 DiagnosticSign = {
88 Warn.link = "DiagnosticWarn";
89 Error.link = "DiagnosticError";
90 Info.link = "DiagnosticInfo";
91 Hint.link = "DiagnosticHint";
92 Ok.link = "DiagnosticOk";
93 };
94
95 DiagnosticUnderline = {
96 Error = { sp = brightRed; undercurl = true; };
97 Warn = { sp = yellow; undercurl = true; };
98 Info = { sp = blue; underdashed = true; };
99 Hint = { sp = muted; underdotted = true; };
100 };
101
102 Telescope = {
103 Normal = { fg = white; bg = black; };
104 Border = { fg = split; bg = black; };
105 Matching = { fg = blue; bold = true; };
106 };
107
108 # Syntax Groups (descriptions and ordering from `:h w18`)
109 Comment = { fg = muted; italic = true; };
110 Constant.fg = pink;
111 String.fg = green;
112 Character.fg = green;
113 Number.fg = orange;
114 Float.link = "Number";
115 Identifier.fg = white;
116 Function.fg = blue;
117 Statement.fg = magenta;
118 Conditional.fg = red;
119 Repeat.fg = magenta;
120 Label.fg = magenta;
121 Operator.fg = pink;
122 Keyword.fg = magenta;
123 Tag.fg = pink;
124 Exception.fg = brightRed;
125 PreProc.fg = yellow;
126 Include.fg = brightBlue;
127 Define.fg = magenta;
128 Macro.fg = magenta;
129 PreCondit.fg = yellow;
130 Type.fg = aqua;
131 StorageClass.fg = yellow;
132 Structure.fg = yellow;
133 Typedef.fg = yellow;
134 Special.fg = orange;
135 SpecialChar.fg = brightGreen;
136 Delimiter.fg = cyan;
137 Debug.force = true;
138 Ignore.force = true;
139 SpecialComment.fg = muted;
140 Error.fg = brightRed;
141 Todo.fg = brightBlue;
142 GhostText.fg = grey;
143 Underlined.underline = true;
144
145 Boolean.link = "Conditional";
146
147 # Built-in Treesitter classes
148 "@constant".link = "Constant";
149 "@constant.builtin".link = "Special";
150 "@constant.macro".link = "Define";
151 "@keyword.directive".link = "Define";
152 "@string".link = "String";
153 "@string.escape".link = "SpecialChar";
154 "@string.special".link = "SpecialChar";
155 "@number".link = "Number";
156 "@number.float".link = "Float";
157 "@function".link = "Function";
158 "@function.builtin".link = "Special";
159 "@function.macro".link = "Macro";
160 "@function.method".link = "Function";
161 "@function.parameter".link = "Function";
162 "@variable.parameter".link = "Identifier";
163 "@variable.parameter.builtin".link = "Special";
164 "@attribute".link = "Macro";
165 "@attribute.builtin".link = "Special";
166 "@keyword.type".link = "Structure";
167 "@label".link = "Label";
168 "@operator".link = "Operator";
169 "@keyword".link = "Keyword";
170 "@variable".link = "Identifier";
171 "@conditional".link = "Conditional";
172 "@include".link = "Include";
173 "@boolean".link = "Boolean";
174 "@type".link = "Type";
175 "@type.definition".link = "Typedef";
176 "@module".link = "Identifier";
177 "@keyword.debug".link = "Debug";
178 "@tag".link = "Tag";
179 "@tag.builtin".link = "Special";
180
181 # Treesitter classes
182 "@comment.todo" = { fg = brightBlue; underline = true; };
183 "@comment.error" = { fg = brightRed; underline = true; };
184 "@comment.note" = { fg = magenta; underline = true; };
185 "@constructor".link = "Structure";
186 "@markup.raw".link = "@string";
187 "@markup.list".link = "@operator";
188 "@markup.strong".bold = true;
189 "@markup.strikethrough".strikethrough = true;
190 "@markup.underline".link = "Underlined";
191 "@markup.italic".italic = true;
192 "@markup.link.label".fg = cyan;
193 "@markup.link.url" = { fg = brightBlue; underline = true; };
194 "@markup.heading" = { fg = blue; bold = true; };
195 "@string.special.url" = { fg = brightBlue; underline = true; };
196 "@punctuation.bracket".link = "@operator";
197 "@punctuation.delimiter".link = "Delimiter";
198 "@punctuation.special".link = "SpecialChar";
199 "@keyword.exception".link = "@conditional";
200 "@keyword.return".link = "@conditional";
201 "@keyword.conditional".link = "@conditional";
202 "@keyword.repeat".link = "@conditional";
203 "@keyword.operator".link = "@operator";
204 "@keyword.import".link = "@include";
205 "@property".fg = pink;
206 "@variable.member".link = "@property";
207 "@variable.builtin".link = "Special";
208 "@type.builtin".link = "Special";
209
210 # Built-in LSP classes
211 "@lsp.type.class".link = "Structure";
212 "@lsp.type.comment".link = "Comment";
213 "@lsp.type.decorator".link = "Function";
214 "@lsp.type.enum".link = "Structure";
215 "@lsp.type.enumMember".link = "Constant";
216 "@lsp.type.function".link = "Function";
217 "@lsp.type.interface".link = "Structure";
218 "@lsp.type.macro".link = "Macro";
219 "@lsp.type.method".link = "Function";
220 "@lsp.type.namespace".link = "Structure";
221 "@lsp.type.struct".link = "Structure";
222 "@lsp.type.type".link = "Type";
223 "@lsp.type.variable".link = "Identifier";
224
225 # LSP classes
226 "@lsp.type.typeParameter".link = "@variable";
227 "@lsp.type.parameter".link = "@variable";
228 "@lsp.type.property".link = "@variable.member";
229 };
230in {
231 my-theme = pkgs.vimUtils.buildVimPlugin {
232 name = "my-theme";
233 src = pkgs.writeTextFile {
234 name = "theme.vim";
235 destination = "/colors/theme.lua";
236 text = ''
237 vim.cmd('highlight clear')
238 vim.cmd('syntax reset')
239 ${highlights}
240 '';
241 };
242 };
243}