dotfiles/vim/lua/lightline_config.lua

111 lines
2.2 KiB
Lua

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
require("lualine").setup({
options = {
icons_enabled = false,
theme = "nord",
component_separators = "",
section_separators = { left = "", right = "" },
},
sections = {
lualine_a = {
{
"mode",
fmt = function(mode)
return mode_map[mode] or mode
end,
},
"paste",
},
lualine_b = { "filename" },
lualine_c = {
{
"branch",
padding = 1,
},
-- 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" },
padding = 1,
},
{
function()
return format_diff_element(vim.b.gitsigns_status_dict.changed, "~")
end,
color = { fg = "#ebcb8b" },
padding = 1,
},
{
function()
return format_diff_element(vim.b.gitsigns_status_dict.removed, "-")
end,
color = { fg = "#bf616a" },
padding = 1,
},
{
"diagnostics",
sources = { "nvim_lsp" },
always_visible = false,
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,
},
},
},
lualine_x = {
{
function()
local go_status_line = vim.api.nvim_call_function("go#statusline#Show", {})
if go_status_line ~= "" then
return go_status_line
end
return vim.bo.filetype
end,
padding = { left = 1, right = 0 },
},
},
lualine_y = { { "progress", padding = { left = 1, right = 1 } } },
lualine_z = { { "location", padding = { left = 1, right = 1 } } },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { { "location", padding = { right = 0 } } },
lualine_y = {},
lualine_z = {},
},
})