summaryrefslogtreecommitdiffstats
path: root/after/plugin/statusline.lua
diff options
context:
space:
mode:
Diffstat (limited to 'after/plugin/statusline.lua')
-rw-r--r--after/plugin/statusline.lua118
1 files changed, 31 insertions, 87 deletions
diff --git a/after/plugin/statusline.lua b/after/plugin/statusline.lua
index 1da1163..9e578a7 100644
--- a/after/plugin/statusline.lua
+++ b/after/plugin/statusline.lua
@@ -5,63 +5,19 @@ end
el.reset_windows()
-local builtin = require "el.builtin"
-local sections = require "el.sections"
+local builtin = require("el.builtin")
+local sections = require("el.sections")
local c = require "components"
--- color setup
-local hl_statusline = "StatusLine"
---diagnostic colors
-local hl_hint = "DiagnosticHint"
-local hl_info = "DiagnosticInfo"
-local hl_warn = "DiagnosticWarn"
-local hl_err = "DiagnosticError"
--- git colors
-local hl_red = "ErrorMsg"
-local hl_green = "diffAdded"
-local hl_yellow = "WarningMsg"
-local highlights = {
- -- diagnostic colors
- diag_err = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_err] = "fg" },
- bold = true,
- }),
- diag_warn = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_warn] = "fg" },
- bold = true,
- }),
- diag_info = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_info] = "fg" },
- bold = true,
- }),
- diag_hint = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_hint] = "fg" },
- bold = true,
- }),
-
- -- git colors
- red_fg = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_red] = "fg" },
- bold = true,
- }),
- green_fg = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_green] = "fg" },
- bold = true,
- }),
- yellow_fg = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_yellow] = "fg" },
- bold = true,
- }),
-}
+local function hl(fg, b)
+ b = b or false
+ return c.extract_hl({
+ bg = {["StatusLine"] = "bg"},
+ fg = {[fg] = "fg"},
+ bold = b,
+ })
+end
--- modes
local modes = {
-- display name, mode, highlight group
n = { "Normal", "N" },
@@ -79,56 +35,44 @@ local modes = {
ic = { "ICompl", "Ic" },
R = { "Replace", "R" },
Rv = { "VReplace", "Rv" },
- c = { "Command", "C" },
+ c = { "Command", "C", hl("DiagnosticHint")},
cv = { "Vim Ex", "E" },
ce = { "Ex (r)", "E" },
r = { "Prompt", "P" },
- rm = { "More ", "M" },
+ rm = { "More", "M" },
["r?"] = { "Confirm", "Cn" },
- ["!"] = { "Shell ", "S" },
- nt = { "Term ", "T" },
- t = { "Term ", "T" },
+ ["!"] = { "Shell", "S" },
+ nt = { "Term", "T" },
+ t = { "Term", "T" },
}
el.setup {
generator = function()
- local items = {
- { c.mode { modes = modes, fmt = " %s %s ", icon = "", hl_icon_only = false } },
+ return {
+ { { " " }, c.mode { modes = modes, hl_icon_only = false } },
{ sections.split, required = true },
{ sections.collapse_builtin { { builtin.filetype }, { " " } } },
{ sections.maximum_width(builtin.tail_file, 0.50), required = true },
{ sections.collapse_builtin { { " " }, { builtin.modified_flag } } },
{ sections.split, required = true },
+ { c.lsp_srvname },
{ c.diagnostics {
- fmt = "[%s]", lsp = true,
- hl_err = highlights.diag_err,
- hl_warn = highlights.diag_warn,
- hl_info = highlights.diag_info,
- hl_hint = highlights.diag_hint,
- icon_err = 'x', icon_warn = '!', icon_info = 'i', icon_hint = 'h'
- }
- },
- { c.git_branch { fmt = "%s *%s", icon = "" } },
+ 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]",
- icon_insert = "+",
- icon_change = "~",
- icon_delete = "-",
- hl_insert = highlights.green_fg,
- hl_change = highlights.yellow_fg,
- hl_delete = highlights.red_fg,
+ hl_insert = hl("GitSignsAdd", true),
+ hl_change = hl("GitSignsChange", true),
+ hl_delete = hl("GitSignsDelete", true),
}},
+ { { " " }, c.line {
+ fmt = "ʟ[%s]",
+ }, required = true },
}
-
- local add_item = function(result, item)
- table.insert(result, item)
- end
-
- local result = {}
- for _, item in ipairs(items) do
- add_item(result, item)
- end
-
- return result
end
}