Skip to content

Commit 1ec73ce

Browse files
committed
feat(statusline): Added custom statusline for the quickfix menu
1 parent b80869d commit 1ec73ce

File tree

2 files changed

+94
-1
lines changed

2 files changed

+94
-1
lines changed

lua/bars/highlights.lua

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,70 @@ highlights.groups = {
13331333
group = "StatusLine",
13341334
value = { link = "Normal" }
13351335
},
1336+
1337+
quickfix_gradient = {
1338+
value = function ()
1339+
---|fS
1340+
1341+
---@type integer, integer, integer
1342+
local R, G, B = highlights.num_to_rgb(
1343+
highlights.get_attr({ "@conditional", "Conditional" }, "fg") or
1344+
highlights.theme_value(
1345+
tonumber("8839EF", 16),
1346+
tonumber("CBA6F7", 16)
1347+
)
1348+
);
1349+
1350+
---@type integer, integer, integer
1351+
local tR, tG, tB = highlights.num_to_rgb(
1352+
highlights.get_attr({ "Normal" }, "bg") or
1353+
highlights.theme_value(
1354+
tonumber("CDD6F4", 16),
1355+
tonumber("1E1E2E", 16)
1356+
)
1357+
);
1358+
1359+
local COLORS = {};
1360+
local MAX = 15;
1361+
1362+
for i = 0, MAX - 1 do
1363+
---@type integer, integer, integer
1364+
local mR, mG, mB = highlights.mix(
1365+
R, G, B,
1366+
tR, tG, tB,
1367+
i / (MAX - 1)
1368+
);
1369+
1370+
local next_bg;
1371+
1372+
if i ~= 0 then
1373+
next_bg = highlights.rgb_to_hex(
1374+
highlights.mix(
1375+
R, G, B,
1376+
tR, tG, tB,
1377+
(i - 1) / (MAX - 1)
1378+
)
1379+
);
1380+
end
1381+
1382+
table.insert(COLORS, {
1383+
group = string.format("BarsQuickfix%d", i + 1),
1384+
value = {
1385+
bg = highlights.rgb_to_hex(mR, mG, mB),
1386+
fg = i == 0 and highlights.get_nfg(
1387+
highlights.rgb_to_lumen(mR, mG, mB)
1388+
) or next_bg,
1389+
1390+
bold = i == 0
1391+
}
1392+
});
1393+
end
1394+
1395+
return COLORS;
1396+
1397+
---|fE
1398+
end
1399+
},
13361400
};
13371401

13381402
--- Applies highlight groups.

lua/bars/statusline.lua

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ statusline.config = {
244244

245245
---|fE
246246
},
247+
247248
["help"] = {
248249
---|fS "Help statusline"
249250

@@ -283,7 +284,35 @@ statusline.config = {
283284
}
284285

285286
---|fE
286-
}
287+
},
288+
289+
quickfix = {
290+
---|fS "Help statusline"
291+
292+
condition = function (buffer)
293+
return vim.bo[buffer].buftype == "quickfix";
294+
end,
295+
components = {
296+
{
297+
kind = "custom",
298+
value = function ()
299+
local text = "%#BarsQuickfix1#";
300+
text = text .. " 󱌢 Quickfix ";
301+
302+
for i = 2, 15, 1 do
303+
text = text .. string.format("%%#BarsQuickfix%d#", i);
304+
text = text .. "";
305+
end
306+
307+
return text;
308+
end
309+
},
310+
{ kind = "empty", hl = "Normal" },
311+
TEMPLATES.mode,
312+
}
313+
314+
---|fE
315+
},
287316
};
288317

289318
---@type statusline.state

0 commit comments

Comments
 (0)