Remove active buffer italics in heirline

This commit is contained in:
2024-02-21 10:51:32 +01:00
parent 1306fba6cf
commit 9c42072c6b

View File

@@ -1,86 +1,99 @@
---@type LazySpec ---@type LazySpec
return { return {
"rebelot/heirline.nvim", {
optional = true, "AstroNvim/astroui",
opts = function(_, opts) dependencies = { "astrobox" },
local status = require("astroui.status") opts = {
local comp = status.component status = {
attributes = {
opts.statusline = { buffer_active = { bold = true, italic = false },
hl = { fg = "fg", bg = "bg" },
comp.mode({ mode_text = { hl = { bold = true }, padding = { left = 1, right = 1 } } }),
comp.file_info({
filetype = false,
filename = {
modify = ":~:.",
}, },
file_modified = {},
}),
comp.diagnostics(),
comp.fill(),
comp.cmd_info(),
comp.fill(),
comp.lsp(),
comp.treesitter({ padding = { right = 1 } }), -- Extra space to separate from next component
comp.git_diff(),
comp.git_branch(),
comp.nav({ scrollbar = false }),
}
local get_file_path = status.provider.filename({
modify = ":~:.:h", -- Relative path and cut filename
})
-- Fix path separation on windows
local path_func = get_file_path
if vim.fn.has("win32") then
path_func = function(self)
local str = get_file_path(self)
return string.gsub(str, "\\", "/")
end
end
opts.winbar = {
init = function(self) self.bufnr = vim.api.nvim_get_current_buf() end,
fallthrough = false,
{
condition = function() return not status.condition.is_active() end,
{
-- Set display priority to hide when component is too big to fit
flexible = 1,
comp.separated_path({
flexible = 2,
max_depth = 5,
path_func = path_func,
}),
comp.separated_path({
flexible = 3,
max_depth = 3,
path_func = path_func,
}),
comp.separated_path({
flexible = 4,
max_depth = 1,
path_func = path_func,
}),
{
-- Hide
provider = "",
},
},
comp.file_info({
file_icon = { hl = status.hl.file_icon("winbar"), padding = { left = 0 } },
file_modified = {},
file_read_only = {},
filename = {},
filetype = false,
hl = status.hl.get_attributes("winbarnc", true),
surround = false,
update = "BufEnter",
}),
}, },
comp.breadcrumbs(), },
} },
{
"rebelot/heirline.nvim",
optional = true,
opts = function(_, opts)
local status = require("astroui.status")
local comp = status.component
return opts opts.statusline = {
end, hl = { fg = "fg", bg = "bg" },
comp.mode({ mode_text = { hl = { bold = true }, padding = { left = 1, right = 1 } } }),
comp.file_info({
filetype = false,
filename = {
modify = ":~:.",
},
file_modified = {},
}),
comp.diagnostics(),
comp.fill(),
comp.cmd_info(),
comp.fill(),
comp.lsp(),
comp.treesitter({ padding = { right = 1 } }), -- Extra space to separate from next component
comp.git_diff(),
comp.git_branch(),
comp.nav({ scrollbar = false }),
}
local get_file_path = status.provider.filename({
modify = ":~:.:h", -- Relative path and cut filename
})
-- Fix path separation on windows
local path_func = get_file_path
if vim.fn.has("win32") then
path_func = function(self)
local str = get_file_path(self)
return string.gsub(str, "\\", "/")
end
end
opts.winbar = {
init = function(self) self.bufnr = vim.api.nvim_get_current_buf() end,
fallthrough = false,
{
condition = function() return not status.condition.is_active() end,
{
-- Set display priority to hide when component is too big to fit
flexible = 1,
comp.separated_path({
flexible = 2,
max_depth = 5,
path_func = path_func,
}),
comp.separated_path({
flexible = 3,
max_depth = 3,
path_func = path_func,
}),
comp.separated_path({
flexible = 4,
max_depth = 1,
path_func = path_func,
}),
{
-- Hide
provider = "",
},
},
comp.file_info({
file_icon = { hl = status.hl.file_icon("winbar"), padding = { left = 0 } },
file_modified = {},
file_read_only = {},
filename = {},
filetype = false,
hl = status.hl.get_attributes("winbarnc", true),
surround = false,
update = "BufEnter",
}),
},
comp.breadcrumbs(),
}
return opts
end,
},
} }