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

138 lines
3.7 KiB
Lua

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_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 = {
{
'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 = 4,
symbols = { readonly = ' 󰌾 ', modified = '' },
},
},
lualine_x = {
{
function()
---@alias NoiceStatusOv {has:(fun():boolean), get:(fun():string), get_hl:(fun():string)}
return require('noice')
.api
.status
.command --[[@as NoiceStatusOv]]
.get()
end,
cond = function()
return package.loaded['noice']
and require('noice')
.api
.status
.command --[[@as NoiceStatusOv]]
.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,
}