Files
dotfiles/nix/home/neovim/nvim/lua/plugins/lualine.lua
2024-07-31 11:36:56 +02:00

106 lines
3.2 KiB
Lua

-- A blazing fast and easy to configure neovim statusline plugin written in pure lua.
-- https://github.com/nvim-lualine/lualine.nvim
return {
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
dependencies = {
"nvim-tree/nvim-web-devicons",
"linrongbin16/lsp-progress.nvim",
},
opts = function()
local icons = require("lazyvim.config").icons
local function fg(name)
return function()
---@type {foreground?:number}?
local hl = vim.api.nvim_get_hl_by_name(name, true)
return hl and hl.foreground and { fg = string.format("#%06x", hl.foreground) }
end
end
return {
options = {
icons_enabled = true,
theme = "transparent",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = { "alpha", "dashboard", "lazy " },
always_divide_middle = true,
globalstatus = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch" },
lualine_c = {
{
"diagnostics",
symbols = {
error = icons.diagnostics.Error,
warn = icons.diagnostics.Warn,
info = icons.diagnostics.Info,
hint = icons.diagnostics.Hint,
},
},
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
{ "filename", path = 3, symbols = { modified = "", readonly = "", unnamed = "" } },
{
"harpoon2",
indicators = { "1", "2", "3", "4", "5" },
active_indicators = { "[1]", "[2]", "[3]", "[4]", "[5]" },
separator = " ",
},
},
lualine_x = {
{ require("lsp-progress").progress },
{
function()
return require("noice").api.status.command.get()
end,
cond = function()
return package.loaded["noice"] and require("noice").api.status.command.has()
end,
color = fg("Statement"),
},
{
function()
return require("noice").api.status.mode.get()
end,
cond = function()
return package.loaded["noice"] and require("noice").api.status.mode.has()
end,
color = fg("Constant"),
},
{ require("lazy.status").updates, cond = require("lazy.status").has_updates, color = fg("Special") },
{
"diff",
symbols = {
added = icons.git.added,
modified = icons.git.modified,
removed = icons.git.removed,
},
},
},
lualine_y = {
{ "progress", separator = "", padding = { left = 1, right = 0 } },
{ "location", padding = { left = 0, right = 1 } },
},
lualine_z = {
function()
return "" .. os.date("%R")
end,
},
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
extensions = { "neo-tree" },
}
end,
}