Skip to content

[Bug]: Error when pinning tab #1036

@Luquatic

Description

@Luquatic

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

The issue is that I receive an error when pinning a tab:

Error executing Lua callback: ...hare/nvim/lazy/bufferline.nvim/lua/bufferline/groups.lua:153: Invalid buffer id: 4
stack traceback:
	[C]: in function 'nvim_buf_get_name'
	...hare/nvim/lazy/bufferline.nvim/lua/bufferline/groups.lua:153: in function 'persist_pinned_buffers'
	...hare/nvim/lazy/bufferline.nvim/lua/bufferline/groups.lua:332: in function 'remove_element'
	...hare/nvim/lazy/bufferline.nvim/lua/bufferline/groups.lua:482: in function 'toggle_pin'
	...local/share/nvim/lazy/bufferline.nvim/lua/bufferline.lua:172: in function <...local/share/nvim/lazy/bufferline.nvim/lua/bufferline.lua:172> 

What did you expect to happen?

Expected behaviour to not receive an error

Config

default LazyVim with catppuccin.lua

return {
  "catppuccin/nvim",
  priority = 1000,
  lazy = true,
  name = "catppuccin",
  opts = {
    flavour = "mocha",
    transparent_background = true,
    float = {
      transparent = true,
    },
    integrations = {
      aerial = true,
      alpha = true,
      cmp = true,
      dashboard = true,
      flash = true,
      fzf = true,
      grug_far = true,
      gitsigns = true,
      headlines = true,
      illuminate = true,
      indent_blankline = { enabled = true },
      leap = true,
      lsp_trouble = true,
      mason = true,
      markdown = true,
      mini = true,
      native_lsp = {
        enabled = true,
        underlines = {
          errors = { "undercurl" },
          hints = { "undercurl" },
          warnings = { "undercurl" },
          information = { "undercurl" },
        },
      },
      navic = { enabled = true, custom_bg = "lualine" },
      neotest = true,
      neotree = true,
      noice = true,
      notify = true,
      semantic_tokens = true,
      snacks = true,
      telescope = true,
      treesitter = true,
      treesitter_context = true,
      which_key = true,
    },
  },
  specs = {
    {
      "akinsho/bufferline.nvim",
      after = "catppuccin",
      dependencies = "nvim-tree/nvim-web-devicons",
      config = function()
        require("bufferline").setup({
          highlights = require("catppuccin.special.bufferline").get_theme(),
        })
      end,
    },
  },
}

Additional Information

I also tried the following specs but receive the same error:

{
  "akinsho/bufferline.nvim",
  optional = true,
  opts = function(_, opts)
    if (vim.g.colors_name or ""):find("catppuccin") then
      opts.highlights = require("catppuccin.special.bufferline").get_theme()
    end
  end,
}

commit

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions