Neovim/lua/plugins/lualine.lua

172 lines
7.1 KiB
Lua

return {
{
"nvim-lualine/lualine.nvim",
opts = function()
local options = require("options")
return {
options = {
theme = "auto",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
globalstatus = true,
},
sections = {
lualine_a = {
{
function()
return ""
end,
separator = { left = "", right = "" },
padding = 1,
fmt = function(text)
return string.gsub(text, "%s+", "")
end,
},
{
"mode",
padding = 0,
fmt = function(text)
return string.gsub(text, "%s+", "") .. " "
end,
},
},
lualine_b = {
{
"filename",
color = "lualine_b_terminal",
symbols = {
modified = "", -- Text to show when the file is modified.
readonly = "", -- Text to show when the file is non-modifiable or readonly.
unnamed = "", -- Text to show for unnamed buffers.
newfile = "[New]", -- Text to show for newly created file before first write
},
},
},
lualine_c = {
{
function()
return ''
end,
padding = 0,
on_click = function()
vim.defer_fn(function()
vim.cmd("ToggleTerm direction=horizontal")
end, 100)
end
},
{
function()
return ' 󰒲 '
end,
padding = 0,
on_click = function()
vim.defer_fn(function()
vim.cmd("Lazy")
end, 100)
end
},
{
function()
return ''
end,
padding = 0,
on_click = function()
vim.defer_fn(function()
vim.cmd("Mason")
end, 100)
end
},
{
"branch",
icon = "󰊤",
on_click = function()
vim.defer_fn(function()
vim.cmd("Telescope git_branches")
end, 100)
end,
},
{
"diff",
symbols = {
added = "+",
modified = "~",
removed = "-",
},
on_click = function()
vim.defer_fn(function()
vim.cmd("Gitsigns diffthis")
end, 100)
end,
},
{
"diagnostics",
symbols = {
error = options.lsp.icons.Error,
warn = options.lsp.icons.Warn,
info = options.lsp.icons.Info,
hint = options.lsp.icons.Hint,
},
sources = {
"nvim_diagnostic",
},
update_in_insert = true,
on_click = function()
vim.defer_fn(function()
vim.cmd("TroubleToggle")
end, 100)
end,
}
},
lualine_x = {
{
function()
local client_id = vim.lsp.get_client_by_id(1)
return "" .. client_id.name
end,
on_click = function()
vim.defer_fn(function()
vim.cmd("LspInfo")
end, 100)
end,
color = "lualine_c_inactive",
},
{
"filetype",
colored = true,
on_click = function(_, _)
vim.defer_fn(function()
vim.cmd("Telescope filetypes")
end, 100)
end,
},
"encoding",
"fileformat",
},
lualine_y = {
{ "progress" },
},
lualine_z = { "location" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {
{
"filename",
symbols = {
modified = "", -- Text to show when the file is modified.
readonly = "", -- Text to show when the file is non-modifiable or readonly.
unnamed = "", -- Text to show for unnamed buffers.
newfile = "[New]", -- Text to show for newly created file before first write
},
},
},
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
}
end,
},
}