mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 00:49:03 +02:00
feat(lualine): better lualine with lazy.nvim updates and some noice components
This commit is contained in:
parent
9026668f2f
commit
7306952f80
1 changed files with 67 additions and 19 deletions
|
@ -69,35 +69,83 @@ return {
|
|||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local navic = require("nvim-navic")
|
||||
local lualine = require("lualine")
|
||||
local symbols = require("lazyvim.config.settings")
|
||||
lualine.setup({
|
||||
override = function(config)
|
||||
return config
|
||||
end,
|
||||
config = function(plugin)
|
||||
local icons = require("lazyvim.config.settings").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
|
||||
|
||||
require("lualine").setup(plugin.override({
|
||||
options = {
|
||||
theme = "auto",
|
||||
globalstatus = true,
|
||||
disabled_filetypes = { statusline = { "lazy", "alpha" } },
|
||||
disabled_filetypes = { statusline = { "dashboard", "lazy", "alpha" } },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = {
|
||||
{ "branch" },
|
||||
{
|
||||
"diff",
|
||||
symbols = { added = symbols.icons.git.added, modified = symbols.icons.git.modified, removed = symbols.icons.git.removed }, -- changes diff symbols
|
||||
},
|
||||
},
|
||||
lualine_b = { "branch" },
|
||||
lualine_c = {
|
||||
{
|
||||
"diagnostics",
|
||||
symbols = { error = symbols.icons.diagnostics.Error, warn = symbols.icons.diagnostics.Warn, info = symbols.icons.diagnostics.Info, hint = symbols.icons.diagnostics.Hint }
|
||||
symbols = {
|
||||
error = icons.diagnostics.Error,
|
||||
warn = icons.diagnostics.Warn,
|
||||
info = icons.diagnostics.Info,
|
||||
hint = icons.diagnostics.Hint,
|
||||
},
|
||||
},
|
||||
{ "filename", padding = { left = 1, right = 1 } },
|
||||
{ navic.get_location, cond = navic.is_available }
|
||||
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
|
||||
{ "filename", path = 1, symbols = { modified = " ", readonly = "", unnamed = "" } },
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return require("nvim-navic").get_location() end,
|
||||
cond = function() return package.loaded["nvim-navic"] and require("nvim-navic").is_available() end,
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
end
|
||||
lualine_x = {
|
||||
-- stylua: ignore
|
||||
{
|
||||
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")
|
||||
},
|
||||
-- stylua: ignore
|
||||
{
|
||||
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,
|
||||
},
|
||||
},
|
||||
extensions = { "nvim-tree" },
|
||||
}))
|
||||
end,
|
||||
},
|
||||
|
||||
-- indent guides for Neovim
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue