Neovim/lua/plugins/lualine.lua

133 lines
5.4 KiB
Lua

return {
{
"nvim-lualine/lualine.nvim",
opts = function()
local options = require("options")
return {
options = {
theme = "vscode",
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",
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 = {
{
"branch",
icon = "󰊤",
},
{
"diff",
symbols = {
added = "+",
modified = "~",
removed = "-",
},
on_click = function()
vim.defer_fn(function()
vim.cmd("Gitsigns diffthis")
end, 100)
end,
},
},
lualine_x = {
{
function()
local client_id = vim.lsp.get_client_by_id(1)
return " LSP ~ " .. client_id.name
end,
on_click = function()
vim.defer_fn(function()
vim.cmd("LspInfo")
end, 100)
end,
color = "lualine_c_inactive",
},
{
"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,
},
{
"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,
},
}