Skip to content

Commit

Permalink
feat(astroui): use opts table for configuring when winbar is enable…
Browse files Browse the repository at this point in the history
…d/disabled
  • Loading branch information
mehalter committed Jun 20, 2024
1 parent 874db46 commit 211e0d1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lua/astronvim/plugins/_astroui_status.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
return {
"AstroNvim/astroui",
opts_extend = {
"status.winbar.enabled.filetype",
"status.winbar.enabled.buftype",
"status.winbar.enabled.bufname",
"status.winbar.disabled.filetype",
"status.winbar.disabled.buftype",
"status.winbar.disabled.bufname",
},
---@param opts AstroUIOpts
opts = function(_, opts)
local sign_handlers = {}
Expand Down Expand Up @@ -237,6 +245,10 @@ return {

return colors
end,
winbar = {
enabled = { bufname = {}, buftype = {}, filetype = {} },
disabled = { bufname = {}, buftype = { "terminal", "nofile" }, filetype = {} },
},
}
end,
}
1 change: 1 addition & 0 deletions lua/astronvim/plugins/gitsigns.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ return {
maps.n["<Leader>gd"] = { function() require("gitsigns").diffthis() end, desc = "View Git diff" }
end,
},
{ "AstroNvim/astroui", opts = { status = { winbar = { enabled = { filetype = { "gitsigns.blame" } } } } } },
},
event = "User AstroGitFile",
opts = function()
Expand Down
6 changes: 5 additions & 1 deletion lua/astronvim/plugins/heirline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ return {
},
opts = function()
local status = require "astroui.status"
local ui_config = require("astroui").config
return {
opts = {
colors = require("astroui").config.status.setup_colors(),
disable_winbar_cb = function(args)
local enabled = vim.tbl_get(ui_config, "status", "winbar", "enabled")
if enabled and status.condition.buffer_matches(enabled, args.buf) then return false end
local disabled = vim.tbl_get(ui_config, "status", "winbar", "enabled")
return not require("astrocore.buffer").is_valid(args.buf)
or status.condition.buffer_matches({ buftype = { "terminal", "nofile" } }, args.buf)
or (disabled and status.condition.buffer_matches(disabled, args.buf))
end,
},
statusline = { -- statusline
Expand Down

0 comments on commit 211e0d1

Please sign in to comment.