dotfiles/vim/lua/lightline_config.lua

112 lines
2.2 KiB
Lua
Raw Normal View History

2023-09-20 20:55:38 +00:00
require("nvim-web-devicons").setup({})
local mode_map = {
NORMAL = "N",
INSERT = "I",
REPLACE = "R",
COMMAND = "C",
VISUAL = "v",
["V-BLOCK"] = "V",
["V-LINE"] = "V-LINE",
}
local function format_diff_element(val, sym)
if val == nil or val < 1 then
return ""
end
return sym .. val
end
2024-03-10 11:47:53 +00:00
local diagnostics = {
"diagnostics",
sources = { "nvim_lsp" },
diagnostics_color = {
error = { fg = "#ffffff", bg = "#bf616a" },
warn = { fg = "#ebcb8b" },
info = { fg = "#81a1c1" },
hint = { fg = "#a3be8c" },
},
always_visible = false,
separator = { left = " " },
symbols = {
error = function(count)
return count .. "E"
end,
warn = function(count)
return count .. "W"
end,
info = function(count)
return count .. "I"
end,
hint = function(count)
return count .. "H"
end,
},
}
2023-09-20 20:55:38 +00:00
require("lualine").setup({
options = {
icons_enabled = false,
2024-12-03 03:13:06 +00:00
theme = "gruxbox_dark",
2023-12-04 08:14:38 +00:00
component_separators = "",
section_separators = { left = "", right = "" },
2023-09-20 20:55:38 +00:00
},
sections = {
lualine_a = {
{
"mode",
fmt = function(mode)
return mode_map[mode] or mode
end,
},
2023-09-21 03:36:09 +00:00
"paste",
2023-09-20 20:55:38 +00:00
},
lualine_b = { "filename" },
lualine_c = {
2023-09-21 03:36:09 +00:00
{
"branch",
2023-12-04 08:14:38 +00:00
padding = 1,
2023-09-21 03:36:09 +00:00
},
-- render coloured output from gitsigns, this doesn't seem to work with b:gitsigns_status:
{
function()
return format_diff_element(vim.b.gitsigns_status_dict.added, "+")
end,
color = { fg = "#a3be8c" },
},
{
function()
return format_diff_element(vim.b.gitsigns_status_dict.changed, "~")
end,
color = { fg = "#ebcb8b" },
},
{
function()
return format_diff_element(vim.b.gitsigns_status_dict.removed, "-")
end,
color = { fg = "#bf616a" },
2023-09-20 20:55:38 +00:00
},
2024-03-10 11:47:53 +00:00
diagnostics,
2023-09-20 20:55:38 +00:00
},
2023-09-21 03:36:09 +00:00
lualine_x = {
{
function()
return vim.bo.filetype
end,
padding = { left = 1, right = 0 },
},
},
2023-12-04 08:14:38 +00:00
lualine_y = { { "progress", padding = { left = 1, right = 1 } } },
2023-10-01 06:09:56 +00:00
lualine_z = { { "location", padding = { left = 1, right = 1 } } },
2023-09-21 03:36:09 +00:00
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
2024-03-10 11:47:53 +00:00
lualine_c = { "filename", diagnostics },
2023-09-21 03:36:09 +00:00
lualine_x = { { "location", padding = { right = 0 } } },
lualine_y = {},
lualine_z = {},
2023-09-20 20:55:38 +00:00
},
})