Switch to Astrov4

This commit is contained in:
2023-12-09 23:30:29 +01:00
parent 3b1035fd35
commit 5f86dedac9
29 changed files with 328 additions and 300 deletions

View File

@@ -0,0 +1,82 @@
return {
"rebelot/heirline.nvim",
optional = true,
opts = function(_, opts)
local status = require("astroui.status")
opts.statusline = {
hl = { fg = "fg", bg = "bg" },
status.component.mode { mode_text = { hl = { bold = true }, padding = { left = 1, right = 1 } } },
status.component.file_info {
filetype = false,
filename = {
modify = ":~:.",
},
file_modified = {},
},
status.component.diagnostics(),
status.component.fill(),
status.component.cmd_info(),
status.component.fill(),
status.component.lsp(),
status.component.treesitter { padding = { right = 1 } }, -- Extra space to separate from next component
status.component.git_diff(),
status.component.git_branch(),
status.component.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,
status.component.separated_path {
flexible = 2,
max_depth = 5,
path_func = path_func,
},
status.component.separated_path {
flexible = 3,
max_depth = 3,
path_func = path_func,
},
status.component.separated_path {
flexible = 4,
max_depth = 1,
path_func = path_func,
},
{
-- Hide
provider = "",
},
},
status.component.file_info {
file_icon = { hl = status.hl.file_icon("winbar"), padding = { left = 0 } },
file_modified = false,
file_read_only = false,
hl = status.hl.get_attributes("winbarnc", true),
surround = false,
update = "BufEnter",
},
},
status.component.breadcrumbs(),
}
return opts
end,
}