return { "nvim-lualine/lualine.nvim", event = "VeryLazy", dependencies = { "nvim-tree/nvim-web-devicons" }, config = function() local lualine = require("lualine") local colors = { lime = "#71f79f", red = "#ed254e", orange = "#ff6a00", yellow = "#f9dc5c", purple = "#c74ded", dark_purple = "#7b7bbd", blue = "#7cb7ff", cyan = "#00c1e4", teal = "#00e8c6", watermelon = "#ff4d7a", white = "#fefefe", text = "#c3c7d1", subtext1 = "#a8b2c0", subtext0 = "#8a96a8", base = "#161925", mantle = "#121520", surface0 = "#1a1f2e", surface1 = "#222e39", surface2 = "#31363d", } local conditions = { buffer_not_empty = function() return vim.fn.empty(vim.fn.expand("%:t")) ~= 1 end, hide_in_width = function() return vim.fn.winwidth(0) > 80 end, check_git_workspace = function() local filepath = vim.fn.expand("%:p:h") local gitdir = vim.fn.finddir(".git", filepath .. ";") return gitdir and #gitdir > 0 and #gitdir < #filepath end, is_code_file = function() local ft = vim.bo.filetype return ft == "javascript" or ft == "typescript" or ft == "lua" or ft == "python" or ft == "jsx" or ft == "tsx" end, } local config = { options = { component_separators = "", section_separators = "", theme = { normal = { c = { fg = colors.fg, bg = colors.bg } }, inactive = { c = { fg = colors.fg, bg = colors.bg } }, }, }, sections = { lualine_a = {}, lualine_b = {}, lualine_y = {}, lualine_z = {}, lualine_c = {}, lualine_x = {}, }, inactive_sections = { lualine_a = {}, lualine_b = {}, lualine_y = {}, lualine_z = {}, lualine_c = {}, lualine_x = {}, }, } local function ins_left(component) table.insert(config.sections.lualine_c, component) end local function ins_right(component) table.insert(config.sections.lualine_x, component) end -- Left Side -- Component: Mode ins_left { "mode", color = function() local mode_color = { n = colors.lime, i = colors.blue, v = colors.purple, [''] = colors.purple, V = colors.purple, c = colors.yellow, R = colors.red, t = colors.teal } return { bg = colors.mantle, fg = mode_color[vim.fn.mode()], gui = "bold" } end, padding = { left = 1, right = 1 } } -- Separator Mode->Filename ins_left { function() return "" end, color = { fg = colors.mantle, bg = colors.orange }, padding = 0 } -- Component: Filename ins_left { "filename", path = 1, shorting_target = 32, file_status = true, symbols = { modified = "[+]", readonly = "[RO]", unnamed = "[No Name]" }, cond = conditions.buffer_not_empty, color = { fg = colors.mantle, bg = colors.orange, gui = "bold" }, padding = { left = 1, right = 1 } } -- Seperator Filename -> Git ins_left { function() return "" end, color = { fg = colors.orange, bg = colors.lime }, padding = 0 } -- Component: Git Branch ins_left { "branch", color = { fg = colors.mantle, bg = colors.lime }, padding = { left = 1, right = 1 } } -- Component: Git diff status ins_left { "diff", symbols = { added = '+', modified = '!', removed = '-' }, diff_color = { added = { fg = colors.bg, bg = colors.lime }, modified = { fg = colors.dark_purple, bg = colors.lime }, removed = { fg = colors.red, bg = colors.lime }, }, cond = conditions.check_git_workspace, padding = { left = 0, right = 1 }, } -- Seperator Git -> Function ins_left { function() return "" end, color = { fg = colors.lime, bg = colors.watermelon }, padding = 0 } -- Component: Current Function ins_left { function() local ft = vim.bo.filetype local is_code_file = ft == "javascript" or ft == "typescript" or ft == "lua" or ft == "python" or ft == "jsx" or ft == "tsx" if not is_code_file then return "" end local ts_utils = require("nvim-treesitter.ts_utils") local current_node = ts_utils.get_node_at_cursor() if not current_node then return "" end local function_node = current_node while function_node do local node_type = function_node:type() if node_type == "function_declaration" or node_type == "function_expression" or node_type == "arrow_function" or node_type == "method_definition" then break end function_node = function_node:parent() end if function_node then local name_node = function_node:field("name")[1] if name_node then local name = vim.treesitter.get_node_text(name_node, 0) return name:sub(1, 20) end end return "󰈙" end, icon = "󰊕", color = { fg = colors.mantle, bg = colors.watermelon, gui = "bold" }, } -- Seperator End ins_left { function() return "" end, color = { fg = colors.watermelon, bg = colors.surface1 }, padding = { left = 0, right = 1 } } -- Right Side -- Seperator Start ins_right { function() return "" end, color = { fg = colors.teal, bg = colors.surface1 }, padding = 0 } -- Component: Encoding ins_right { "encoding", color = { fg = colors.mantle, bg = colors.teal, gui = "bold" }, } -- Component: Filetype ins_right { "filetype", color = { fg = colors.mantle, bg = colors.teal, gui = "bold" }, } -- Separator: Filetype -> LSP Status ins_right { function() return "" end, color = { fg = colors.dark_purple, bg = colors.teal }, padding = 0 } -- Component: LSP Status ins_right { "lsp_status", color = { fg = colors.text, bg = colors.dark_purple, gui = "bold" } } -- Seperator: LSP Status -> Diagnostics ins_right { function() return "" end, color = { bg = colors.dark_purple, fg = colors.surface0 }, padding = 0 } -- Component: Diagnostics ins_right { "diagnostics", always_visible = true, symbols = { error = "[E]", warn = "[W]", info = "[I]", hint = "[H]" }, color = { bg = colors.surface0, gui = "bold" } } -- Seperator: Diagnostics -> Location ins_right { function() return "" end, color = { fg = colors.white, bg = colors.surface0 }, padding = 0 } -- Component: Location ins_right { "location", color = { fg = colors.mantle, bg = colors.white, gui = "bold" } } lualine.setup(config) end, }