Skip to content

Commit

Permalink
fix: refactor and improve special statusline/winbar detection in heir…
Browse files Browse the repository at this point in the history
…line
  • Loading branch information
konradmalik committed Sep 21, 2023
1 parent c417304 commit d088238
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions config/native/after/plugin/heirline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ local Ruler = require("konrad.heirline.ruler")
local ScrollBar = require("konrad.heirline.scrollbar")
local Hostname = require("konrad.heirline.hostname")

local isSpecial = function()
return conditions.buffer_matches({
buftype = { "nofile", "prompt", "help", "quickfix" },
filetype = { "^git.*", "fugitive", "harpoon" },
})
end
local specialsTable = {
buftype = { "nofile", "prompt", "help", "quickfix" },
filetype = { "^git.*", "fugitive", "harpoon", "undotree", "diff" },
}

local InactiveWinbar = {
condition = function()
Expand Down Expand Up @@ -109,7 +107,9 @@ local InactiveStatusline = {
}

local SpecialStatusline = {
condition = isSpecial,
condition = function()
return conditions.buffer_matches(specialsTable)
end,
FileType,
Space,
HelpFileName,
Expand Down Expand Up @@ -158,16 +158,7 @@ heirline.setup({
-- if the callback returns true, the winbar will be disabled for that window
-- the args parameter corresponds to the table argument passed to autocommand callbacks. :h nvim_lua_create_autocmd()
disable_winbar_cb = function(args)
return conditions.buffer_matches({
buftype = { "nofile", "prompt", "help", "quickfix" },
filetype = {
"^git.*",
"fugitive",
-- undotree
"undotree",
"diff",
},
}, args.buf)
return conditions.buffer_matches(specialsTable, args.buf)
end,
},
})

0 comments on commit d088238

Please sign in to comment.