refactor(nvim): improve heirline appearance and perf
All checks were successful
Check Formatting of Files / Check-Formatting (push) Successful in 1m0s

This commit is contained in:
Price Hiller 2024-07-01 15:17:53 -05:00
parent aaa50e9272
commit 27a982fd21
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB

View File

@ -208,6 +208,9 @@ return {
else else
---@diagnostic disable-next-line: cast-local-type ---@diagnostic disable-next-line: cast-local-type
filename = vim.fn.fnamemodify(self.filename, ":~:.") filename = vim.fn.fnamemodify(self.filename, ":~:.")
if not conditions.width_percent_below(#filename, 0.5, true) then
filename = vim.fn.pathshorten(filename)
end
end end
if filename == "" then if filename == "" then
filename = "[No Name]" filename = "[No Name]"
@ -543,6 +546,11 @@ return {
end, end,
}, },
{ {
update = {
"WinResized",
"BufAdd",
"BufEnter",
},
FileNameBlock, FileNameBlock,
static = { static = {
bg_color_right = nil, bg_color_right = nil,
@ -668,10 +676,14 @@ return {
provider = "%=", provider = "%=",
}, },
{ {
update = {
"BufAdd",
"BufEnter",
"FileType",
},
init = function(self) init = function(self)
self.filename = vim.api.nvim_buf_get_name(0) self.filename = vim.api.nvim_buf_get_name(0)
end, end,
{ {
provider = seps.full.left, provider = seps.full.left,
hl = function() hl = function()
@ -747,6 +759,7 @@ return {
}, },
margin(1), margin(1),
{ {
update = "CursorMoved",
{ {
provider = seps.full.left, provider = seps.full.left,
hl = function() hl = function()
@ -941,7 +954,11 @@ return {
{ {
provider = function() provider = function()
local cwd = vim.uv.cwd() or "" local cwd = vim.uv.cwd() or ""
return " " .. vim.fn.pathshorten(vim.fn.fnamemodify(cwd, ":~")) cwd = vim.fn.fnamemodify(cwd, ":~")
if not conditions.width_percent_below(#cwd, 0.3, false) then
cwd = vim.fn.pathshorten(cwd)
end
return " " .. cwd
end, end,
hl = { hl = {
fg = colors.sumiInk0, fg = colors.sumiInk0,