vim: improve color declarations in lualine config

This commit is contained in:
Fernando Schauenburg 2022-02-06 23:22:16 +01:00
parent 0945175fe5
commit d8ba015ccd

View file

@ -1,31 +1,30 @@
local colors = {}
if vim.opt.termguicolors:get() then
colors = {
base03 = '#002b36', yellow = '#b58900',
base02 = '#073642', orange = '#cb4b16',
base01 = '#586e75', red = '#dc322f',
base00 = '#657b83', magenta = '#d33682',
base0 = '#839496', violet = '#6c71c4',
base1 = '#93a1a1', blue = '#268bd2',
base2 = '#eee8d5', cyan = '#2aa198',
base3 = '#fdf6e3', green = '#859900',
}
else
colors = {
base03 = 8, yellow = 3,
base02 = 0, orange = 9,
base01 = 10, red = 1,
base00 = 11, magenta = 5,
base0 = 12, violet = 13,
base1 = 14, blue = 4,
base2 = 7, cyan = 6,
base3 = 15, green = 2,
}
local gui = vim.opt.termguicolors:get()
local function color(tbl)
if gui then return tbl.gui end
return tbl.index
end
base03 = color { index = 8, gui = '#002b36' }
base02 = color { index = 0, gui = '#073642' }
base01 = color { index = 10, gui = '#586e75' }
base00 = color { index = 11, gui = '#657b83' }
base0 = color { index = 12, gui = '#839496' }
base1 = color { index = 14, gui = '#93a1a1' }
base2 = color { index = 7, gui = '#eee8d5' }
base3 = color { index = 15, gui = '#fdf6e3' }
yellow = color { index = 3, gui = '#b58900' }
orange = color { index = 9, gui = '#cb4b16' }
red = color { index = 1, gui = '#dc322f' }
magenta = color { index = 5, gui = '#d33682' }
violet = color { index = 13, gui = '#6c71c4' }
blue = color { index = 4, gui = '#268bd2' }
cyan = color { index = 6, gui = '#2aa198' }
green = color { index = 2, gui = '#859900' }
local paste = {
function() return 'P' end,
color = { fg = colors.base3, bg = colors.yellow, gui = 'bold' },
color = { fg = base3, bg = yellow, gui = 'bold' },
cond = function() return vim.opt.paste:get() end
}
@ -43,50 +42,50 @@ local encoding = function ()
end
-- let padding when using icons leaves too much space
local fileformat = { 'fileformat', padding = { left = 0, right = 1} }
local fileformat = { 'fileformat', padding = { left = 0, right = 1}}
local progress = '%3l/%L%-2v' -- line / total column
require('lualine').setup {
options = {
icons_enabled = true,
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
theme = {
normal = {
a = { fg = colors.base03, bg = colors.blue, gui='bold' },
b = { fg = colors.base2, bg = colors.base00 },
c = { fg = colors.base1, bg = colors.base02 },
},
insert = { a = { fg = colors.base03, bg = colors.green, gui = 'bold' } },
visual = { a = { fg = colors.base03, bg = colors.magenta, gui = 'bold' } },
replace = { a = { fg = colors.base03, bg = colors.red, gui = 'bold' } },
inactive = {
a = { fg = colors.base1, bg = colors.base00 },
b = { fg = colors.base0, bg = colors.base01 },
c = { fg = colors.base00, bg = colors.base02 },
},
options = {
icons_enabled = true,
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
theme = {
normal = {
a = { fg = base03, bg = blue, gui='bold' },
b = { fg = base2, bg = base00 },
c = { fg = base1, bg = base02 },
},
insert = { a = { fg = base03, bg = green, gui = 'bold' } },
visual = { a = { fg = base03, bg = magenta, gui = 'bold' } },
replace = { a = { fg = base03, bg = red, gui = 'bold' } },
inactive = {
a = { fg = base1, bg = base00 },
b = { fg = base0, bg = base01 },
c = { fg = base00, bg = base02 },
},
},
},
sections = {
lualine_a = { 'mode', paste },
lualine_b = { 'diagnostics', 'branch' },
lualine_c = { relative_path },
lualine_x = { 'filetype' },
lualine_y = { encoding, fileformat },
lualine_z = { progress },
},
sections = {
lualine_a = { 'mode', paste },
lualine_b = { 'diagnostics', 'branch' },
lualine_c = { relative_path },
lualine_x = { 'filetype' },
lualine_y = { encoding, fileformat },
lualine_z = { progress },
},
inactive_sections = {
lualine_a = {},
lualine_b = { 'diagnostics', 'branch' },
lualine_c = { relative_path },
lualine_x = { { 'filetype', colored = false } },
lualine_y = { encoding, fileformat },
lualine_z = { progress },
},
inactive_sections = {
lualine_a = {},
lualine_b = { 'diagnostics', 'branch' },
lualine_c = { relative_path },
lualine_x = { { 'filetype', colored = false } },
lualine_y = { encoding, fileformat },
lualine_z = { progress },
},
extensions = { 'fugitive', 'quickfix' }
extensions = { 'fugitive', 'quickfix' }
}