Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable_winbar_cb not working for detecting buffer type #137

Closed
mehalter opened this issue Apr 10, 2023 · 3 comments · Fixed by #157
Closed

disable_winbar_cb not working for detecting buffer type #137

mehalter opened this issue Apr 10, 2023 · 3 comments · Fixed by #157

Comments

@mehalter
Copy link
Contributor

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 !

@rebelot
Copy link
Owner

rebelot commented Apr 10, 2023

good call!

@rebelot
Copy link
Owner

rebelot commented Apr 10, 2023

if only there was a BufType autocmd....

@mehalter
Copy link
Contributor Author

For reals BufType would be so nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants