277 lines
4 KiB
Lua
Executable file
277 lines
4 KiB
Lua
Executable file
-- Eviline config for lualine
|
||
-- Author: shadmansaleh
|
||
-- Credit: glepnir
|
||
local lualine = require('lualine')
|
||
|
||
local colors = {
|
||
bg = '#202328',
|
||
fg = '#bbc2cf',
|
||
yellow = '#ECBE7B',
|
||
cyan = '#008080',
|
||
darkblue = '#081633',
|
||
green = '#98be65',
|
||
orange = '#FF8800',
|
||
violet = '#a9a1e1',
|
||
magenta = '#c678dd',
|
||
blue = '#51afef',
|
||
red = '#ec5f67',
|
||
}
|
||
|
||
|
||
local conditions = {
|
||
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 = {
|
||
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)
|
||
table.insert(config.sections.lualine_c, component)
|
||
end
|
||
|
||
local function ins_right(component)
|
||
table.insert(config.sections.lualine_x, component)
|
||
end
|
||
|
||
ins_left {
|
||
function()
|
||
return '▊'
|
||
end,
|
||
|
||
color = { fg = colors.blue },
|
||
|
||
padding = {
|
||
left = 0,
|
||
right = 1
|
||
},
|
||
}
|
||
|
||
|
||
|
||
ins_left {
|
||
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 {
|
||
'branch',
|
||
icon = '',
|
||
|
||
color = {
|
||
fg = colors.violet,
|
||
gui = 'bold'
|
||
},
|
||
}
|
||
|
||
ins_left {
|
||
'diff',
|
||
|
||
symbols = {
|
||
added = ' ',
|
||
modified = ' ',
|
||
removed = ' '
|
||
},
|
||
|
||
diff_color = {
|
||
added = { fg = colors.green },
|
||
modified = { fg = colors.orange },
|
||
removed = { fg = colors.red },
|
||
},
|
||
|
||
cond = conditions.hide_in_width,
|
||
}
|
||
|
||
|
||
|
||
ins_left {
|
||
'diagnostics',
|
||
|
||
sources = { 'nvim_diagnostic' },
|
||
|
||
symbols = {
|
||
error = ' ',
|
||
warn = ' ',
|
||
info = ' '
|
||
},
|
||
|
||
diagnostics_color = {
|
||
color_error = { fg = colors.red },
|
||
color_warn = { fg = colors.yellow },
|
||
color_info = { fg = colors.cyan },
|
||
},
|
||
}
|
||
|
||
ins_left {
|
||
function()
|
||
return '%='
|
||
end,
|
||
}
|
||
|
||
|
||
ins_left {
|
||
'filename',
|
||
cond = conditions.buffer_not_empty,
|
||
|
||
color = {
|
||
fg = colors.magenta,
|
||
gui = 'bold'
|
||
},
|
||
}
|
||
|
||
|
||
ins_right {
|
||
'filetype',
|
||
colored = true,
|
||
icon_only = false,
|
||
icon = { align = 'right' }
|
||
}
|
||
|
||
ins_right {
|
||
'progress',
|
||
|
||
color = {
|
||
fg = colors.fg,
|
||
gui = 'bold'
|
||
}
|
||
}
|
||
|
||
|
||
ins_right {
|
||
'o:encoding',
|
||
|
||
fmt = string.upper,
|
||
cond = conditions.hide_in_width,
|
||
|
||
color = {
|
||
fg = colors.green,
|
||
gui = 'bold'
|
||
},
|
||
}
|
||
|
||
|
||
ins_right {
|
||
'fileformat',
|
||
|
||
fmt = string.upper,
|
||
icons_enabled = false,
|
||
|
||
color = {
|
||
fg = colors.green,
|
||
gui = 'bold'
|
||
},
|
||
}
|
||
|
||
|
||
ins_right {
|
||
function()
|
||
return '▊'
|
||
end,
|
||
|
||
color = { fg = colors.blue },
|
||
padding = { left = 1 },
|
||
}
|
||
|
||
lualine.setup(config)
|