98 lines
2.4 KiB
Lua
98 lines
2.4 KiB
Lua
return {
|
|
"nvim-lualine/lualine.nvim",
|
|
|
|
dependencies = "nvim-tree/nvim-web-devicons",
|
|
|
|
opts = function()
|
|
local icons = require("util.icons")
|
|
local colored_when_focused = require("util.lualine").colored_when_focused
|
|
local indicator = require("util.lualine").indicator
|
|
local window = require("util.window")
|
|
local orange = "#d65d0e"
|
|
|
|
local is_diagnostics_enabled = function(bufnr)
|
|
return vim.diagnostic.is_enabled { bufnr = bufnr or 0 }
|
|
end
|
|
|
|
--
|
|
-- Components
|
|
--
|
|
|
|
local autoformat = indicator {
|
|
icon = icons.ui.Format,
|
|
cond = require("util.autoformat").is_enabled,
|
|
}
|
|
local branch = {
|
|
"branch",
|
|
icon = icons.git.Branch,
|
|
cond = window.is_medium,
|
|
}
|
|
local diagnostics = {
|
|
colored_when_focused("diagnostics"),
|
|
cond = is_diagnostics_enabled,
|
|
}
|
|
local diag_status = indicator {
|
|
icon = icons.ui.Diagnostic,
|
|
cond = is_diagnostics_enabled,
|
|
}
|
|
local fileformat = {
|
|
"fileformat",
|
|
cond = window.is_medium,
|
|
}
|
|
local filename = "custom.filename"
|
|
local filetype = {
|
|
colored_when_focused("filetype"),
|
|
cond = window.is_medium,
|
|
}
|
|
local mode = "custom.mode"
|
|
local searchcount = "custom.searchcount"
|
|
local spell = indicator {
|
|
icon = icons.ui.SpellCheck,
|
|
cond = function() return vim.o.spell end,
|
|
}
|
|
local status = {
|
|
colored_when_focused("custom.status"),
|
|
color = { fg = orange },
|
|
padding = 0,
|
|
}
|
|
local whitespace = {
|
|
colored_when_focused("custom.whitespace"),
|
|
cond = window.is_wide,
|
|
}
|
|
local wrap = indicator {
|
|
icon = icons.ui.TextWrap,
|
|
cond = function() return vim.o.wrap end,
|
|
}
|
|
|
|
--
|
|
-- Sections
|
|
--
|
|
|
|
local sections = {
|
|
lualine_a = { mode },
|
|
lualine_b = { branch },
|
|
lualine_c = { filename, status },
|
|
lualine_x = { diagnostics, searchcount, whitespace, filetype },
|
|
lualine_y = { diag_status, spell, wrap, autoformat, fileformat, "progress" },
|
|
lualine_z = { "location" },
|
|
}
|
|
|
|
return {
|
|
options = {
|
|
icons_enabled = true,
|
|
component_separators = { left = "", right = "" },
|
|
section_separators = { left = "", right = "" },
|
|
},
|
|
sections = sections,
|
|
inactive_sections = sections,
|
|
extensions = {
|
|
"fugitive",
|
|
"quickfix",
|
|
"nvim-tree",
|
|
"lazy",
|
|
"man",
|
|
"trouble",
|
|
},
|
|
}
|
|
end,
|
|
}
|