rebelot/heirline.nvim

`disable_winbar_cb` not working for detecting buffer type

Closed this issue · 3 comments

It seems like sometimes disable_winbar_cb is running before the buffer type is able to be set. Specifically I can replicate this 100% of the time when it comes to terminal buffers.

Here is a minimal neovim configuration that replicates this:

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--branch=stable",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  {
    "rebelot/heirline.nvim",
    opts = {
      opts = {
        disable_winbar_cb = function(args)
          return vim.tbl_contains({ "terminal", "help" }, vim.bo[args.buf].buftype)
        end,
      },
      winbar = {
        provider = "SOME RANDOM TEXT",
      },
    },
  },
})

Steps Reproduce

  1. Use the above init.lua file
  2. run nvim and see "SOME RANDOM TEXT" in winbar
  3. Open a help page (Ex. :h news) and see that the winbar is correctly disabled
  4. run :terminal to open a new terminal buffer, see that the winbar is shown and not disabled when it should be.

Hopefully this is detailed enough to report this issue. Please let me know if you have any questions/need any more clarification !

good call!

if only there was a BufType autocmd....

For reals BufType would be so nice