mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-02-28 03:30:36 +00:00
feat(lualine.lua): add support for molten statusline configuration to enhance statusline customization
105 lines
2.8 KiB
Lua
105 lines
2.8 KiB
Lua
local lualine = require("lualine")
|
|
local lazy_status = require("lazy.status") -- to configure lazy pending updates count
|
|
local molten_status = require("molten.status") -- to configure molten statusline
|
|
|
|
local colors = {
|
|
blue = "#65D1FF",
|
|
green = "#3EFFDC",
|
|
violet = "#FF61EF",
|
|
yellow = "#FFDA7B",
|
|
red = "#FF4A4A",
|
|
fg = "#c3ccdc",
|
|
bg = "#112638",
|
|
inactive_bg = "#2c3043",
|
|
}
|
|
|
|
local my_lualine_theme = {
|
|
normal = {
|
|
a = { bg = colors.blue, fg = colors.bg, gui = "bold" },
|
|
b = { bg = colors.bg, fg = colors.fg },
|
|
c = { bg = colors.bg, fg = colors.fg },
|
|
},
|
|
insert = {
|
|
a = { bg = colors.green, fg = colors.bg, gui = "bold" },
|
|
b = { bg = colors.bg, fg = colors.fg },
|
|
c = { bg = colors.bg, fg = colors.fg },
|
|
},
|
|
visual = {
|
|
a = { bg = colors.violet, fg = colors.bg, gui = "bold" },
|
|
b = { bg = colors.bg, fg = colors.fg },
|
|
c = { bg = colors.bg, fg = colors.fg },
|
|
},
|
|
command = {
|
|
a = { bg = colors.yellow, fg = colors.bg, gui = "bold" },
|
|
b = { bg = colors.bg, fg = colors.fg },
|
|
c = { bg = colors.bg, fg = colors.fg },
|
|
},
|
|
replace = {
|
|
a = { bg = colors.red, fg = colors.bg, gui = "bold" },
|
|
b = { bg = colors.bg, fg = colors.fg },
|
|
c = { bg = colors.bg, fg = colors.fg },
|
|
},
|
|
inactive = {
|
|
a = { bg = colors.inactive_bg, fg = colors.semilightgray, gui = "bold" },
|
|
b = { bg = colors.inactive_bg, fg = colors.semilightgray },
|
|
c = { bg = colors.inactive_bg, fg = colors.semilightgray },
|
|
},
|
|
}
|
|
|
|
function GetPoetvStatusLine()
|
|
-- Get the poetv statusline
|
|
-- If poetv is not active, return empty string
|
|
|
|
if IsPoetvActive() then
|
|
local poetv_name = vim.g.poetv_name
|
|
local poetv_statusline_symbol = vim.g.poetv_statusline_symbol
|
|
|
|
local result = string.sub(poetv_name, 1, 20) .. " " .. poetv_statusline_symbol
|
|
|
|
return result
|
|
else
|
|
return ""
|
|
end
|
|
end
|
|
|
|
function IsPoetvActive()
|
|
-- Check if vim.g.poetv_name exists
|
|
-- If it does, then poetv is active
|
|
|
|
if vim.g.poetv_name ~= nil then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
-- configure lualine with modified theme
|
|
lualine.setup({
|
|
options = {
|
|
theme = my_lualine_theme,
|
|
},
|
|
sections = {
|
|
lualine_x = {
|
|
{
|
|
molten_status.initialized,
|
|
},
|
|
{
|
|
molten_status.kernels,
|
|
},
|
|
{
|
|
GetPoetvStatusLine,
|
|
cond = IsPoetvActive,
|
|
color = { fg = "#ff9e64" },
|
|
},
|
|
{
|
|
lazy_status.updates,
|
|
cond = lazy_status.has_updates,
|
|
color = { fg = "#ff9e64" },
|
|
},
|
|
{ "encoding" },
|
|
{ "fileformat" },
|
|
{ "filetype" },
|
|
},
|
|
},
|
|
})
|