From f0c6f0a1e7aefa3b35846dc6739d2d00651d479b Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 28 May 2026 14:14:11 +0800 Subject: [PATCH] Center-align mini.starter footer text Extract header_lines and compute max_header_width so the footer can be padded to match the header's visual centering. Co-Authored-By: Claude Opus 4.7 (1M context) --- lua/pack.lua | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/lua/pack.lua b/lua/pack.lua index 1bc21dc..942d6c5 100644 --- a/lua/pack.lua +++ b/lua/pack.lua @@ -25,26 +25,36 @@ local function get_total_plugins() return count end +local header_lines = { + "", + " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗", + " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║", + " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║", + " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║", + " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║", + " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝", + "", +} + +local max_header_width = 0 +for _, line in ipairs(header_lines) do + max_header_width = math.max(max_header_width, vim.fn.strdisplaywidth(line)) +end + starter.setup({ autoopen = true, evaluate_single = false, items = { { name = " ", action = "", section = "" } }, - header = table.concat({ - "", - " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗", - " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║", - " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║", - " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║", - " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║", - " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝", - "", - }, "\n"), + header = table.concat(header_lines, "\n"), footer = function() local uv = vim.uv or vim.loop local ms = (uv:hrtime() - _G.nvim_start_time) / 1e6 local loaded = vim.tbl_count(require("lazy")._loaded) local total = get_total_plugins() - return string.format(" Loaded %d/%d plugins in %.0f ms", loaded, total, ms) + local text = string.format(" Loaded %d/%d plugins in %.0f ms", loaded, total, ms) + local text_width = vim.fn.strdisplaywidth(text) + local pad = math.floor((max_header_width - text_width) / 2) + return string.rep(" ", pad) .. text end, content_hooks = { starter.gen_hook.aligning("center", "center"),