trixy/fnl/plugins/lualine.lua

277 lines
4 KiB
Lua
Raw Normal View History

-- Eviline config for lualine
-- Author: shadmansaleh
-- Credit: glepnir
local lualine = require('lualine')
local colors = {
2024-07-12 11:57:47 +02:00
bg = '#202328',
fg = '#bbc2cf',
yellow = '#ECBE7B',
cyan = '#008080',
darkblue = '#081633',
green = '#98be65',
orange = '#FF8800',
violet = '#a9a1e1',
magenta = '#c678dd',
blue = '#51afef',
red = '#ec5f67',
}
2024-07-12 11:57:47 +02:00
local conditions = {
2024-07-12 11:57:47 +02:00
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand('%:p:h')
local gitdir = vim.fn.finddir('.git', filepath .. ';')
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
-- Config
local config = {
2024-07-12 11:57:47 +02:00
options = {
component_separators = '',
section_separators = '',
theme = {
normal = {
c = {
fg = colors.fg,
bg = colors.bg
}
},
inactive = {
c = {
fg = colors.fg,
bg = colors.bg
}
},
},
},
sections = {
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
lualine_c = {},
lualine_x = {},
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
lualine_c = {},
lualine_x = {},
},
}
local function ins_left(component)
2024-07-12 11:57:47 +02:00
table.insert(config.sections.lualine_c, component)
end
local function ins_right(component)
2024-07-12 11:57:47 +02:00
table.insert(config.sections.lualine_x, component)
end
ins_left {
2024-07-12 11:57:47 +02:00
function()
return ''
end,
color = { fg = colors.blue },
padding = {
left = 0,
right = 1
},
}
ins_left {
2024-07-12 11:57:47 +02:00
function()
return ''
--return ''
-- local mode_string = {
-- n = 'Normal',
-- i = 'Insert',
-- v = 'Visual',
-- V = 'Visual line',
-- c = 'Change',
-- no = 'dunno1',
-- s = 'dunno2',
-- S = 'dunno3',
-- [''] = 'dunno4',
-- ic = 'dunno5',
-- R = 'dunno6',
-- Rv = 'dunno7',
-- cv = 'dunno8',
-- ce = 'dunno9',
-- r = 'dunno10',
-- rm = 'dunno11',
-- ['r?'] = 'dunno12',
-- ['!'] = 'dunno13',
-- t = 'dunno14',
-- }
-- return mode_string[vim.fn.mode()]
--
end,
color = function()
local mode_color = {
n = colors.blue,
i = colors.red,
v = colors.green,
[''] = colors.orange,
V = colors.green,
c = colors.magenta,
no = colors.red,
s = colors.orange,
S = colors.orange,
[''] = colors.orange,
ic = colors.yellow,
R = colors.violet,
Rv = colors.violet,
cv = colors.red,
ce = colors.red,
r = colors.cyan,
rm = colors.cyan,
['r?'] = colors.cyan,
['!'] = colors.red,
t = colors.red,
}
return { fg = mode_color[vim.fn.mode()] }
end,
padding = { right = 1 },
}
ins_left {
2024-07-12 11:57:47 +02:00
'branch',
icon = '',
color = {
fg = colors.violet,
gui = 'bold'
},
}
ins_left {
2024-07-12 11:57:47 +02:00
'diff',
2024-07-12 11:57:47 +02:00
symbols = {
added = '',
modified = '',
removed = ''
},
2024-07-12 11:57:47 +02:00
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.orange },
removed = { fg = colors.red },
},
2024-07-12 11:57:47 +02:00
cond = conditions.hide_in_width,
}
2024-07-12 11:57:47 +02:00
ins_left {
2024-07-12 11:57:47 +02:00
'diagnostics',
2024-07-12 11:57:47 +02:00
sources = { 'nvim_diagnostic' },
2024-07-12 11:57:47 +02:00
symbols = {
error = '',
warn = '',
info = ''
},
diagnostics_color = {
color_error = { fg = colors.red },
color_warn = { fg = colors.yellow },
color_info = { fg = colors.cyan },
},
}
ins_left {
2024-07-12 11:57:47 +02:00
function()
return '%='
end,
}
2024-07-12 11:57:47 +02:00
ins_left {
'filename',
cond = conditions.buffer_not_empty,
color = {
fg = colors.magenta,
gui = 'bold'
},
}
ins_right {
2024-07-12 11:57:47 +02:00
'filetype',
colored = true,
icon_only = false,
icon = { align = 'right' }
}
ins_right {
2024-07-12 11:57:47 +02:00
'progress',
color = {
fg = colors.fg,
gui = 'bold'
}
}
2024-07-12 11:57:47 +02:00
ins_right {
'o:encoding',
2024-07-12 11:57:47 +02:00
fmt = string.upper,
cond = conditions.hide_in_width,
2024-07-12 11:57:47 +02:00
color = {
fg = colors.green,
gui = 'bold'
},
}
2024-07-12 11:57:47 +02:00
ins_right {
2024-07-12 11:57:47 +02:00
'fileformat',
fmt = string.upper,
icons_enabled = false,
color = {
fg = colors.green,
gui = 'bold'
},
}
2024-07-12 11:57:47 +02:00
ins_right {
2024-07-12 11:57:47 +02:00
function()
return ''
end,
color = { fg = colors.blue },
padding = { left = 1 },
2023-07-30 09:07:54 +02:00
}
lualine.setup(config)