feat(heirline): add angled separators, Unicode icons, and progress pill to statusline
This commit is contained in:
1 parent
579db51ee6
commit
9eb60b6cdf
1 file changed
+48
-17
+48
-17
@@ -1,7 +1,12 @@
|
|||||||
--- Custom statusline (heirline via astroui.status components):
|
--- Custom statusline (heirline via astroui.status components):
|
||||||
--- left = NvChad style: mode pill with separators, file info, git branch/diff
|
--- left = NvChad style: angled mode pill, file info pill, git branch/diff
|
||||||
--- right = VSCode style: diagnostics (NvChad icons), LSP, Ln/Col, Spaces,
|
--- right = VSCode-style info modules, ending in an NvChad mode-colored
|
||||||
--- encoding, EOL, filetype — flat text, no powerline chunks
|
--- progress pill (nerd font icon + Top/Bot/percentage)
|
||||||
|
---
|
||||||
|
--- NOTE: every nerd-font PUA glyph in this file is written as a \u{XXXX}
|
||||||
|
--- Lua escape ON PURPOSE — raw 3-byte PUA glyphs (U+E000-U+F8FF) have been
|
||||||
|
--- stripped by tooling before, silently flattening the statusline.
|
||||||
|
--- Keep this file ASCII-only.
|
||||||
---@type LazySpec
|
---@type LazySpec
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
@@ -9,22 +14,23 @@ return {
|
|||||||
---@type AstroUIOpts
|
---@type AstroUIOpts
|
||||||
opts = {
|
opts = {
|
||||||
icons = {
|
icons = {
|
||||||
VimIcon = "",
|
VimIcon = "\u{e62b}", -- nf-custom-vim
|
||||||
GitBranch = "",
|
GitBranch = "\u{e725}", -- nf-dev-git_branch
|
||||||
GitAdd = "",
|
GitAdd = "\u{f457}", -- nf-oct-diff_added
|
||||||
GitChange = "",
|
GitChange = "\u{f459}", -- nf-oct-diff_modified
|
||||||
GitDelete = "",
|
GitDelete = "\u{f458}", -- nf-oct-diff_removed
|
||||||
|
Progress = "\u{f124}", -- nf-fa-location_arrow
|
||||||
-- NvChad diagnostic icons
|
-- NvChad diagnostic icons
|
||||||
DiagnosticError = "",
|
DiagnosticError = "\u{f0159}", -- nf-md-close_circle
|
||||||
DiagnosticWarn = "",
|
DiagnosticWarn = "\u{f071}", -- nf-fa-warning
|
||||||
DiagnosticInfo = "",
|
DiagnosticInfo = "\u{f02fc}", -- nf-md-information
|
||||||
DiagnosticHint = "",
|
DiagnosticHint = "\u{f06e9}", -- nf-md-lightbulb_on
|
||||||
},
|
},
|
||||||
status = {
|
status = {
|
||||||
-- NvChad-style slanted separators for the left-side sections
|
-- NvChad-style angled (powerline arrow) separators
|
||||||
separators = {
|
separators = {
|
||||||
left = { "", "" },
|
left = { "", "\u{e0b0} " }, -- trailing solid right-arrow for left pills
|
||||||
right = { " ", "" },
|
right = { " \u{e0b2}", "" }, -- leading solid left-arrow for right pills
|
||||||
},
|
},
|
||||||
colors = function(hl)
|
colors = function(hl)
|
||||||
local get_hlgroup = require("astroui").get_hlgroup
|
local get_hlgroup = require("astroui").get_hlgroup
|
||||||
@@ -74,7 +80,10 @@ return {
|
|||||||
filetype = false,
|
filetype = false,
|
||||||
file_read_only = false,
|
file_read_only = false,
|
||||||
padding = { right = 1 },
|
padding = { right = 1 },
|
||||||
surround = { separator = "left", condition = false },
|
surround = {
|
||||||
|
separator = "left",
|
||||||
|
color = { main = "file_info_bg", right = "bg" },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
status.component.git_branch {
|
status.component.git_branch {
|
||||||
git_branch = { padding = { left = 1 } },
|
git_branch = { padding = { left = 1 } },
|
||||||
@@ -87,7 +96,7 @@ return {
|
|||||||
|
|
||||||
status.component.fill(),
|
status.component.fill(),
|
||||||
|
|
||||||
-- ────────────────── right: VSCode ──────────────────
|
-- ────────────────── right: VSCode info + NvChad progress ──────────────────
|
||||||
status.component.diagnostics {
|
status.component.diagnostics {
|
||||||
padding = { right = 1 },
|
padding = { right = 1 },
|
||||||
surround = { separator = "none" },
|
surround = { separator = "none" },
|
||||||
@@ -134,6 +143,28 @@ return {
|
|||||||
padding = { right = 1 },
|
padding = { right = 1 },
|
||||||
surround = { separator = "none", condition = false },
|
surround = { separator = "none", condition = false },
|
||||||
},
|
},
|
||||||
|
-- NvChad-style progress pill: mode-colored, angled, nerd font icon
|
||||||
|
status.component.builder {
|
||||||
|
{
|
||||||
|
provider = function()
|
||||||
|
local cur, total = vim.fn.line ".", vim.fn.line "$"
|
||||||
|
local pct
|
||||||
|
if cur == 1 then
|
||||||
|
pct = "Top"
|
||||||
|
elseif cur == total then
|
||||||
|
pct = "Bot"
|
||||||
|
else
|
||||||
|
pct = math.floor(cur / total * 100 + 0.5) .. "%%"
|
||||||
|
end
|
||||||
|
return (" %s %s "):format(require("astroui").get_icon "Progress", pct)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
hl = { fg = "bg", bold = true },
|
||||||
|
surround = {
|
||||||
|
separator = "right",
|
||||||
|
color = function() return { main = status.hl.mode_bg(), left = "bg" } end,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user