vim: WIP statusline
This commit is contained in:
parent
d98842295f
commit
cfb1802c59
1 changed files with 44 additions and 32 deletions
|
@ -15,13 +15,13 @@ local colors = require'fs.util'.colors()
|
||||||
local theme = (function()
|
local theme = (function()
|
||||||
local active = {
|
local active = {
|
||||||
a = Table:new { fg = colors.base03, bg = colors.base1 },
|
a = Table:new { fg = colors.base03, bg = colors.base1 },
|
||||||
b = Table:new { fg = colors.base03, bg = colors.base00 },
|
b = Table:new { fg = colors.base03, bg = colors.base0 },
|
||||||
c = Table:new { fg = colors.base1, bg = colors.base02 },
|
c = Table:new { fg = colors.base1, bg = colors.base02 },
|
||||||
}
|
}
|
||||||
|
|
||||||
local inactive = {
|
local inactive = {
|
||||||
a = { fg = colors.base0, bg = colors.base00 },
|
a = { fg = colors.base02, bg = colors.base00 },
|
||||||
b = { fg = colors.base0, bg = colors.base01 },
|
b = { fg = colors.base02, bg = colors.base01 },
|
||||||
c = { fg = colors.base01, bg = colors.base02 },
|
c = { fg = colors.base01, bg = colors.base02 },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,39 +48,54 @@ local theme = (function()
|
||||||
}
|
}
|
||||||
end)()
|
end)()
|
||||||
|
|
||||||
|
local update_status = function(self, is_focused)
|
||||||
|
self.options.colored = is_focused
|
||||||
|
return self.super.update_status(self, is_focused)
|
||||||
|
end
|
||||||
|
|
||||||
|
local diff = require'lualine.components.diff':extend()
|
||||||
|
diff.update_status = update_status
|
||||||
|
|
||||||
|
local filetype = require'lualine.components.filetype':extend()
|
||||||
|
filetype.update_status = update_status
|
||||||
|
|
||||||
|
local path = function()
|
||||||
|
return vim.fn.pathshorten(vim.fn.fnamemodify(vim.fn.expand('%'), ':p'))
|
||||||
|
end
|
||||||
|
|
||||||
local parts = {
|
local parts = {
|
||||||
|
split = function() return '%=' end,
|
||||||
|
|
||||||
|
mode = 'mode',
|
||||||
|
|
||||||
paste = {
|
paste = {
|
||||||
function()
|
function() return '' end,
|
||||||
return ''
|
|
||||||
end,
|
|
||||||
color = { fg = colors.base03, bg = colors.yellow, gui = 'bold' },
|
color = { fg = colors.base03, bg = colors.yellow, gui = 'bold' },
|
||||||
cond = function()
|
cond = function()
|
||||||
return vim.opt.paste:get()
|
return vim.opt.paste:get()
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
|
||||||
relative_path = {
|
branch = {
|
||||||
'filename',
|
'branch',
|
||||||
path = 1 -- 0: just filenane, 1: realtive path, 2: absolute path
|
icon = '',
|
||||||
},
|
},
|
||||||
|
|
||||||
encoding = function ()
|
diff = {
|
||||||
local fenc = vim.opt.fileencoding:get()
|
diff,
|
||||||
if fenc ~= '' then
|
diff_color = {
|
||||||
return fenc
|
added = { fg = colors.green },
|
||||||
end
|
modified = { fg = colors.yellow },
|
||||||
return vim.opt.encoding:get()
|
removed = { fg = colors.orange },
|
||||||
end,
|
|
||||||
|
|
||||||
fileformat = {
|
|
||||||
'fileformat',
|
|
||||||
padding = {
|
|
||||||
left = 0, -- otherise too sparse with icons
|
|
||||||
right = 1,
|
|
||||||
},
|
},
|
||||||
|
padding = 0,
|
||||||
},
|
},
|
||||||
|
|
||||||
location = '%L𝓁 %3l:%-2v',
|
path = path,
|
||||||
|
|
||||||
|
filetype = filetype,
|
||||||
|
|
||||||
|
location = '%3l:%-2v',
|
||||||
|
|
||||||
progress = {
|
progress = {
|
||||||
function()
|
function()
|
||||||
|
@ -98,11 +113,11 @@ local parts = {
|
||||||
|
|
||||||
local sections = Table:new {
|
local sections = Table:new {
|
||||||
lualine_a = {},
|
lualine_a = {},
|
||||||
lualine_b = { 'branch' },
|
lualine_b = {},
|
||||||
lualine_c = { parts.relative_path },
|
lualine_c = { parts.branch, parts.diff, parts.split, parts.path },
|
||||||
lualine_x = { 'diagnostics', 'filetype' },
|
lualine_x = { 'diagnostics', parts.filetype, 'fileformat' },
|
||||||
lualine_y = { parts.encoding, parts.fileformat },
|
lualine_y = { parts.location },
|
||||||
lualine_z = { parts.location },
|
lualine_z = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
local config = function()
|
local config = function()
|
||||||
|
@ -114,10 +129,7 @@ local config = function()
|
||||||
theme = theme,
|
theme = theme,
|
||||||
},
|
},
|
||||||
|
|
||||||
sections = sections:override {
|
sections = sections:override { lualine_a = { parts.mode, parts.paste } },
|
||||||
lualine_a = { 'mode', parts.paste },
|
|
||||||
lualine_y = { parts.encoding, parts.fileformat, parts.progress },
|
|
||||||
},
|
|
||||||
|
|
||||||
inactive_sections = sections,
|
inactive_sections = sections,
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue