240 lines
7.0 KiB
Lua
240 lines
7.0 KiB
Lua
return {
|
|
'nvim-lualine/lualine.nvim',
|
|
dependencies = {
|
|
'nvim-tree/nvim-web-devicons',
|
|
},
|
|
config = function()
|
|
local function lsp_clients()
|
|
local clients = vim.lsp.get_clients({bufnr = 0,})
|
|
if #clients == 0 then
|
|
return '\u{f072e} none'
|
|
end
|
|
local names = {}
|
|
for i, client in ipairs(clients) do
|
|
if i > 2 then
|
|
table.insert(names, '\u{2026}')
|
|
break
|
|
end
|
|
table.insert(names, client.name)
|
|
end
|
|
return '\u{f0ccb} ' .. table.concat(names, ', ')
|
|
end
|
|
|
|
--------------------------------------------------------------------------
|
|
-- Palette: reusable semantic colors (component-level fg, mode accents)
|
|
--------------------------------------------------------------------------
|
|
local palette = {
|
|
cream = '#fbf1c7',
|
|
dark = '#1d2021',
|
|
mid_dark = '#3c3836',
|
|
gray = '#7c6f64',
|
|
|
|
-- Mode accents (only section a changes per mode)
|
|
normal_a = '#076678',
|
|
insert_a = '#79740e',
|
|
visual_a = '#d65d0e',
|
|
replace_a = '#9d0006',
|
|
command_a = '#427b58',
|
|
|
|
-- Component fg: section b / y
|
|
branch_fg = '#1d2021',
|
|
diff_add = '#005f00',
|
|
diff_mod = '#654600',
|
|
diff_rem = '#870000',
|
|
diag_err = '#9d0006',
|
|
diag_warn = '#b57614',
|
|
diag_info = '#076678',
|
|
diag_hint = '#427b58',
|
|
|
|
-- Component fg: section c
|
|
filename_fg = '#282828',
|
|
|
|
-- Component fg: section x
|
|
lsp_fg = '#427b58',
|
|
encoding_fg = '#7c6f64',
|
|
format_fg = '#8f3f71',
|
|
filetype_fg = '#076678',
|
|
|
|
-- Component fg: section y / z
|
|
progress_fg = '#3c3836',
|
|
}
|
|
|
|
--------------------------------------------------------------------------
|
|
-- Section colors: explicit bg/fg for every section, independently tunable
|
|
--------------------------------------------------------------------------
|
|
local sec = {
|
|
a = {bg = palette.normal_a, fg = palette.cream,},
|
|
b = {bg = '#bdae93', fg = palette.dark,},
|
|
c = {bg = '#ebdbb2', fg = palette.mid_dark,},
|
|
x = {bg = '#ebdbb2', fg = palette.mid_dark,},
|
|
y = {bg = '#bdae93', fg = palette.dark,},
|
|
z = {bg = palette.normal_a, fg = palette.cream,},
|
|
}
|
|
|
|
--------------------------------------------------------------------------
|
|
-- Theme: every mode defines a through z explicitly
|
|
--------------------------------------------------------------------------
|
|
local function mode_theme(a_bg)
|
|
return {
|
|
a = {bg = a_bg, fg = palette.cream, gui = 'bold',},
|
|
b = {bg = sec.b.bg, fg = sec.b.fg,},
|
|
c = {bg = sec.c.bg, fg = sec.c.fg,},
|
|
x = {bg = sec.x.bg, fg = sec.x.fg,},
|
|
y = {bg = sec.y.bg, fg = sec.y.fg,},
|
|
z = {bg = sec.z.bg, fg = sec.z.fg, gui = 'bold',},
|
|
}
|
|
end
|
|
|
|
local custom_theme = {
|
|
normal = mode_theme(palette.normal_a),
|
|
insert = mode_theme(palette.insert_a),
|
|
visual = mode_theme(palette.visual_a),
|
|
replace = mode_theme(palette.replace_a),
|
|
command = mode_theme(palette.command_a),
|
|
inactive = {
|
|
a = {bg = sec.b.bg, fg = palette.gray,},
|
|
b = {bg = sec.b.bg, fg = palette.gray,},
|
|
c = {bg = sec.c.bg, fg = palette.gray,},
|
|
x = {bg = sec.x.bg, fg = palette.gray,},
|
|
y = {bg = sec.y.bg, fg = palette.gray,},
|
|
z = {bg = sec.z.bg, fg = palette.gray,},
|
|
},
|
|
}
|
|
|
|
require('lualine').setup({
|
|
options = {
|
|
icons_enabled = true,
|
|
theme = custom_theme,
|
|
-- Thick slants between sections, thin slants between components
|
|
section_separators = {left = '\u{e0b8}', right = '\u{e0be}',},
|
|
component_separators = {left = '\u{e0b9}', right = '\u{e0bf}',},
|
|
disabled_filetypes = {
|
|
statusline = {},
|
|
winbar = {},
|
|
},
|
|
ignore_focus = {},
|
|
always_divide_middle = true,
|
|
always_show_tabline = true,
|
|
globalstatus = false,
|
|
refresh = {
|
|
statusline = 1000,
|
|
tabline = 1000,
|
|
winbar = 1000,
|
|
refresh_time = 16,
|
|
events = {
|
|
'WinEnter',
|
|
'BufEnter',
|
|
'BufWritePost',
|
|
'SessionLoadPost',
|
|
'FileChangedShellPost',
|
|
'VimResized',
|
|
'Filetype',
|
|
'CursorMoved',
|
|
'CursorMovedI',
|
|
'ModeChanged',
|
|
},
|
|
},
|
|
},
|
|
sections = {
|
|
lualine_a = {
|
|
{'mode', fmt = function(s) return s:sub(1, 1) end,},
|
|
},
|
|
lualine_b = {
|
|
{
|
|
'branch',
|
|
icon = '\u{e0a0}',
|
|
color = {fg = palette.branch_fg, gui = 'bold',},
|
|
},
|
|
{
|
|
'diff',
|
|
symbols = {
|
|
added = ' ',
|
|
modified = '≈ ',
|
|
removed = ' ',
|
|
},
|
|
diff_color = {
|
|
added = {fg = palette.diff_add,},
|
|
modified = {fg = palette.diff_mod,},
|
|
removed = {fg = palette.diff_rem,},
|
|
},
|
|
},
|
|
{
|
|
'diagnostics',
|
|
symbols = {
|
|
error = '\u{f0024} ',
|
|
warn = '\u{f0026} ',
|
|
info = '\u{f002d} ',
|
|
hint = '\u{f0335} ',
|
|
},
|
|
diagnostics_color = {
|
|
error = {fg = palette.diag_err,},
|
|
warn = {fg = palette.diag_warn,},
|
|
info = {fg = palette.diag_info,},
|
|
hint = {fg = palette.diag_hint,},
|
|
},
|
|
},
|
|
},
|
|
lualine_c = {
|
|
{
|
|
'filename',
|
|
path = 1,
|
|
symbols = {
|
|
modified = ' \u{25cf}',
|
|
readonly = ' \u{f033e}',
|
|
},
|
|
color = {fg = palette.filename_fg, gui = 'bold',},
|
|
},
|
|
},
|
|
lualine_x = {
|
|
-- c\u{2192}x transition: invisible when same bg, slant when different
|
|
{
|
|
function() return '\u{e0be}' end,
|
|
color = {fg = sec.x.bg, bg = sec.c.bg,},
|
|
padding = 0,
|
|
},
|
|
{
|
|
lsp_clients,
|
|
color = {fg = palette.lsp_fg, gui = 'italic',},
|
|
},
|
|
{
|
|
'encoding',
|
|
fmt = string.upper,
|
|
color = {fg = palette.encoding_fg,},
|
|
},
|
|
{
|
|
'fileformat',
|
|
symbols = {
|
|
unix = '',
|
|
dos = '',
|
|
mac = '',
|
|
},
|
|
color = {fg = palette.format_fg,},
|
|
},
|
|
{
|
|
'filetype',
|
|
color = {fg = palette.filetype_fg,},
|
|
},
|
|
},
|
|
lualine_y = {
|
|
{'progress', color = {fg = palette.progress_fg,},},
|
|
},
|
|
lualine_z = {
|
|
{'location', icon = '\u{f0ea0}', color = {fg = palette.cream, gui = 'bold',},},
|
|
},
|
|
},
|
|
inactive_sections = {
|
|
lualine_a = {},
|
|
lualine_b = {},
|
|
lualine_c = {'filename',},
|
|
lualine_x = {'location',},
|
|
lualine_y = {},
|
|
lualine_z = {},
|
|
},
|
|
tabline = {},
|
|
winbar = {},
|
|
inactive_winbar = {},
|
|
extensions = {},
|
|
})
|
|
end,
|
|
}
|