marleyvim/nvim/lua/plugins/ui/lualine-nvim.lua

127 lines
3.4 KiB
Lua
Raw Normal View History

2024-11-30 12:51:28 -08:00
return {
'lualine.nvim',
event = 'DeferredUIEnter',
beforeAll = function()
vim.g.lualine_laststatus = vim.o.laststatus
if vim.fn.argc(-1) > 0 then
-- Set an empty statusline until lualine loads.
vim.o.statusline = ' '
else
-- Hide the statusline on the starter page.
vim.o.laststatus = 0
end
end,
before = function()
require('lz.n').trigger_load('mini.icons')
if vim.g.colors_name == 'rose-pine' then
require('lz.n').trigger_load('rose-pine')
end
end,
after = function()
local lazyvim_lualine = require('lib.lazyvim.lualine')
local lazyvim_ui = require('lib.lazyvim.ui')
local icons = require('icons')
vim.o.laststatus = vim.g.lualine_laststatus
require('lualine').setup({
options = {
theme = 'auto',
globalstatus = vim.o.laststatus == 3,
disabled_filetypes = {
statusline = {
'dashboard',
'alpha',
'ministarter',
'snacks_dashboard',
},
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch' },
lualine_c = {
lazyvim_lualine.root_dir(),
{
'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 },
},
{ lazyvim_lualine.pretty_path() },
},
lualine_x = {
{
function()
return require('noice').api.status.command.get()
end,
cond = function()
return package.loaded['noice']
and require('noice').api.status.command.has()
end,
color = function()
return lazyvim_ui.fg('Statement')
end,
},
{
function()
return '' .. require('dap').status()
end,
cond = function()
return package.loaded['dap'] and require('dap').status ~= ''
end,
color = function()
return lazyvim_ui.fg('debug')
end,
},
{
'diff',
symbols = {
added = icons.git.added,
modified = icons.git.modified,
removed = icons.git.removed,
},
source = function()
local gitsigns = vim.b.gitsigns_status_dict
if gitsigns then
return {
added = gitsigns.added,
modified = gitsigns.changed,
removed = gitsigns.removed,
}
end
end,
},
},
lualine_y = {
{ 'progress', separator = ' ', padding = { left = 1, right = 0 } },
{ 'location', padding = { left = 0, right = 1 } },
},
lualine_z = {
function()
return '' .. os.date('%R')
end,
},
},
extensions = { 'neo-tree' },
},
})
end,
}