Skip to content

Commit

Permalink
fix(winbar): don't modify winbar for disabled buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Aug 29, 2023
1 parent 1840fe2 commit 556f398
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lua/heirline/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,18 @@ local function setup_local_winbar_with_autocmd(callback)
local augrp_id = vim.api.nvim_create_augroup("Heirline_init_winbar", { clear = true })
vim.api.nvim_create_autocmd({ "VimEnter", "UIEnter", "BufWinEnter", "FileType", "TermOpen" }, {
callback = function(args)
local winbar_disabled = callback and callback(args) == true
if args.event == "VimEnter" or args.event == "UIEnter" then
for _, win in ipairs(vim.api.nvim_list_wins()) do
local winbuf = vim.api.nvim_win_get_buf(win)
local new_args = vim.deepcopy(args)
new_args.buf = winbuf
if callback and callback(new_args) == true then
vim.wo[win].winbar = nil
else
if not winbar_disabled then
vim.wo[win].winbar = "%{%v:lua.require'heirline'.eval_winbar()%}"
end
end
end
if callback and callback(args) == true then
vim.opt_local.winbar = nil
if winbar_disabled then
return
end

Expand Down

0 comments on commit 556f398

Please sign in to comment.