tiagovla / scope.nvim

Revolutionize Your Neovim Tab Workflow: Introducing Enhanced Tab Scoping!
406 stars 21 forks source link

[Bug] Buffer is not set as "listed" when edit with "buffer" command in second tab #14

Open tuanbass opened 1 year ago

tuanbass commented 1 year ago

Environment Lazyvim (https://www.lazyvim.org/)

return {
  {
    -- asscociate buffer to tab
    "tiagovla/scope.nvim",
    lazy = false,
    config = function() require("scope").setup() end,
    keys = { { "<leader>fB", "<cmd>Telescope scope buffers<cr>", desc = "All buffers" } },
  },
  { "famiu/bufdelete.nvim" },
  {
    "akinsho/bufferline.nvim",
    opts = {
      options = {
        always_show_bufferline = true,
        numbers = function(opts) return string.format("%s", opts.id) end,
      }, -- always show tabs, event if there is only one tab
    },
  },
}

Reproduces:

  1. Open 2 buffers A and B. Get a buffer number (using ls)
  2. Create a new tab (using tabnew)
  3. in second tab, open buffer A which previously in tab1 using command buffer <bnumber>
  4. Buffer A openned in tab2, but not shown in bufferline, even with always_show_bufferline=true
  5. ls command in tab2 does not show buffer A.
tuanbass commented 1 year ago

It could be fixed with a simple:

    vim.api.nvim_buf_set_option(0, "buflisted", true)

But I dont know which event I should put the command. Tried with BufAdd but it's seem have random behavior, sometime it works, sometime not (at least I didn't figure out the pattern)

muhmud commented 10 months ago

I am also having this issue.

It would be great if when you go to a buffer in a different tab, it would actually switch to that tab from the current one.