103 lines
3.3 KiB
Lua
103 lines
3.3 KiB
Lua
-- Hole die Macchiato Palette von Catppuccin
|
|
local cp = require("catppuccin.palettes").get_palette "macchiato"
|
|
|
|
local colors = {
|
|
red = cp.red, -- #ed8796
|
|
grey = cp.surface2, -- Ein mittleres Grau für die B-Sektion
|
|
black = cp.crust, -- Sehr dunkles Grau/Schwarz für die Ränder
|
|
white = cp.text, -- Haupttextfarbe
|
|
light_green = cp.teal, -- Für den Insert-Modus (etwas frischer)
|
|
orange = cp.peach, -- Für den Visual-Modus
|
|
green = cp.green, -- Für den Replace-Modus
|
|
bg_center = cp.mantle, -- Hintergrund für den mittleren Teil (C)
|
|
}
|
|
|
|
local theme = {
|
|
normal = {
|
|
a = { fg = cp.base, bg = cp.blue, gui = "bold" }, -- Blau für Normal Mode
|
|
b = { fg = colors.white, bg = colors.grey },
|
|
c = { fg = colors.white, bg = colors.bg_center },
|
|
},
|
|
insert = { a = { fg = cp.base, bg = colors.light_green, gui = "bold" } },
|
|
visual = { a = { fg = cp.base, bg = colors.orange, gui = "bold" } },
|
|
replace = { a = { fg = cp.base, bg = colors.green, gui = "bold" } },
|
|
command = { a = { fg = cp.base, bg = cp.yellow, gui = "bold" } },
|
|
}
|
|
|
|
local empty = require("lualine.component"):extend()
|
|
function empty:draw(default_highlight)
|
|
self.status = ""
|
|
self.applied_separator = ""
|
|
self:apply_highlights(default_highlight)
|
|
self:apply_section_separators()
|
|
return self.status
|
|
end
|
|
|
|
-- Hilfsfunktion für die Trenner
|
|
local function process_sections(sections)
|
|
for name, section in pairs(sections) do
|
|
-- Wir nutzen hier cp.mantle für die Lücken, damit es zum Catppuccin-Fluss passt
|
|
for pos = #section - 1, 1, -1 do
|
|
table.insert(section, pos + 1, { empty, color = { fg = colors.white, bg = cp.mantle } })
|
|
end
|
|
|
|
for id, comp in ipairs(section) do
|
|
if type(comp) ~= "table" then
|
|
comp = { comp }
|
|
section[id] = comp
|
|
end
|
|
-- Die schrägen Trenner ( und ) bleiben erhalten
|
|
local is_left = name:sub(9, 10) < "x"
|
|
comp.separator = is_left and { right = "" } or { left = "" }
|
|
end
|
|
end
|
|
return sections
|
|
end
|
|
|
|
-- Deine Hilfsfunktionen bleiben identisch
|
|
local function search_result()
|
|
if vim.v.hlsearch == 0 then return "" end
|
|
local last_search = vim.fn.getreg "/"
|
|
if not last_search or last_search == "" then return "" end
|
|
local searchcount = vim.fn.searchcount { maxcount = 9999 }
|
|
return last_search .. " (" .. searchcount.current .. "/" .. searchcount.total .. ")"
|
|
end
|
|
|
|
local function modified()
|
|
if vim.bo.modified then
|
|
return " ●" -- Ein schönerer Punkt für Catppuccin
|
|
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
|
|
return " " -- Ein Schloss-Icon für Readonly
|
|
end
|
|
return ""
|
|
end
|
|
|
|
-- Rückgabe für das Lualine Setup
|
|
return {
|
|
"lualine.nvim",
|
|
opts = {
|
|
options = {
|
|
theme = theme,
|
|
component_separators = "",
|
|
section_separators = { left = "", right = "" },
|
|
disabled_filetypes = { "alpha", "dashboard", "NvimTree" },
|
|
},
|
|
sections = process_sections {
|
|
lualine_a = { "mode" },
|
|
lualine_b = { "branch", "diff", "diagnostics" },
|
|
lualine_c = { "filename", modified },
|
|
lualine_x = { search_result, "filetype" },
|
|
lualine_y = { "progress" },
|
|
lualine_z = { "location" },
|
|
},
|
|
inactive_sections = {
|
|
lualine_a = {},
|
|
lualine_b = {},
|
|
lualine_c = { "filename" },
|
|
lualine_x = { "location" },
|
|
lualine_y = {},
|
|
lualine_z = {},
|
|
},
|
|
},
|
|
}
|