From 08fc1f5bf4b29767e0a63993bd9100c5a07515a2 Mon Sep 17 00:00:00 2001 From: Haelnorr Date: Sat, 15 Feb 2025 10:40:40 +1100 Subject: [PATCH] Customized lualine --- lua/haelnorr/lazy/lualine.lua | 53 ++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/lua/haelnorr/lazy/lualine.lua b/lua/haelnorr/lazy/lualine.lua index 3cc8e66..d498a65 100644 --- a/lua/haelnorr/lazy/lualine.lua +++ b/lua/haelnorr/lazy/lualine.lua @@ -1,10 +1,61 @@ return { "nvim-lualine/lualine.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, + dependencies = { + "nvim-tree/nvim-web-devicons", + "catppuccin/nvim", + }, config = function() + local mocha = require("catppuccin.palettes").get_palette("mocha") + local function get_path() + local filepath = vim.api.nvim_buf_get_name(0) + local parent = vim.fn.fnamemodify(filepath, ":h:t") + local filename = vim.fn.fnamemodify(filepath, ":t") + if parent == "" then + return "" + end + + local grandparent = vim.fn.fnamemodify(filepath, ":h:h") + local prefix = grandparent ~= "" and ".." or "" + + return prefix .. "/" .. parent .. "/" .. filename + end require("lualine").setup({ options = { theme = "catppuccin", + component_separators = { left = "|", right = "|" }, + section_separators = { left = "", right = "" }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff" }, + lualine_c = { + { + get_path, + color = { bg = mocha.surface2 }, + separator = { right = "" }, + }, + }, + lualine_x = { "diagnostics" }, + lualine_y = { + { + "filetype", + color = { bg = mocha.flamingo, fg = mocha.crust }, + }, + }, + lualine_z = { + { + "location", + color = { bg = mocha.maroon }, + }, + }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { get_path }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, }, }) end,