local status_ok, el = pcall(require, "el") if not status_ok then return end el.reset_windows() local builtin = require("el.builtin") local sections = require("el.sections") local c = require("core.statusbar.components") local function hl(fg, b) b = b or false return c.extract_hl({ bg = { ["StatusLine"] = "bg" }, fg = { [fg] = "fg" }, bold = b, }) end local modes = { -- display name, mode, highlight group n = { "Normal", "N", hl("@neorg.headings.1.title") }, niI = { "Normal", "N", hl("@neorg.headings.1.title") }, niR = { "Normal", "N", hl("@neorg.headings.1.title") }, niV = { "Normal", "N", hl("@neorg.headings.1.title") }, no = { "N·OpPd", "?" }, v = { "Visual", "V", hl("@neorg.headings.2.title") }, V = { "V·Line", "Vl", hl("@neorg.headings.2.title") }, [""] = { "V·Block", "Vb", hl("@neorg.headings.2.title") }, s = { "Select", "S" }, S = { "S·Line", "Sl" }, [""] = { "S·Block", "Sb" }, i = { "Insert", "I", hl("@neorg.headings.4.title") }, ic = { "ICompl", "Ic" }, R = { "Replace", "R", hl("@neorg.headings.5.title") }, Rv = { "VReplace", "Rv", hl("@neorg.headings.5.title") }, c = { "Command", "C", hl("@neorg.headings.3.title") }, cv = { "Vim Ex", "E" }, ce = { "Ex (r)", "E" }, r = { "Prompt", "P" }, rm = { "More", "M" }, ["r?"] = { "Confirm", "Cn" }, ["!"] = { "Shell", "S" }, nt = { "Term", "T" }, t = { "Term", "T" }, } el.setup { generator = function() return { { { " " }, c.mode { modes = modes, hl_icon_only = false } }, { sections.split, required = true }, { sections.collapse_builtin { { builtin.filetype }, { " " } } }, { sections.maximum_width(c.fn_tail, 0.50), required = true }, { sections.collapse_builtin { { " " }, { builtin.modified_flag } } }, { sections.split, required = true }, { c.lsp_srvname }, { c.diagnostics { fmt = "[%s]", hl_err = hl("DiagnosticError", true), hl_warn = hl("DiagnosticWarn", true), hl_info = hl("DiagnosticInfo", true), hl_hint = hl("DiagnosticHint", true) }}, { c.git_branch { icon = "*", fmt = " %s%s" } }, { c.git_changes_buf { fmt = "[%s]", hl_insert = hl("GitSignsAdd", true), hl_change = hl("GitSignsChange", true), hl_delete = hl("GitSignsDelete", true), }}, { { " " }, c.line { fmt = "[%s]", }, required = true }, } end }