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

Buffer order lost when using tiagovla/scope.nvim #556

Closed
Iron-E opened this issue Mar 19, 2024 · 2 comments · Fixed by #559
Closed

Buffer order lost when using tiagovla/scope.nvim #556

Iron-E opened this issue Mar 19, 2024 · 2 comments · Fixed by #559
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Iron-E
Copy link
Collaborator

Iron-E commented Mar 19, 2024

It seems to be an interaction between tiagovla/scope.nvim and barbar.nvim.

From @alexconst in #555 (comment):

scope.nvim does expose several hooks for tab enter and tabe leave, so maybe fixing this is feasible.

Does barbar.nvim exposes any way to get or set the buffer order? I take it it's using its own variables to track it because :ls and vim.api.nvim_list_bufs() always shows the same buffer order.

For reference sake, here is my minimal.lua which reproduces the issue:

local data_dir = vim.fn.stdpath 'data'
local plugin_dir = data_dir .. '/lazy/'

vim.opt.rtp:prepend { plugin_dir .. 'barbar.nvim' }
vim.g.barbar_auto_setup = false
require('barbar').setup {
    icons = {
        filetype = { enabled = false },
    },
}

-- https://github.com/tiagovla/scope.nvim
vim.opt.rtp:prepend { plugin_dir .. 'scope.nvim' }
require("scope").setup({})

To reproduce:

  1. nvim --clean -u minimal.lua aaa bbb ccc ddd eee
  2. reorder some buffers
  3. open new tab :tabe foo
  4. go back to first tab
  5. see that your custom buffer ordering has been lost
@Iron-E Iron-E added the bug Something isn't working label Mar 19, 2024
@Iron-E
Copy link
Collaborator Author

Iron-E commented Mar 19, 2024

scope.nvim does expose several hooks for tab enter and tabe leave, so maybe fixing this is feasible.

Good to know, I'll take a look at those.

Does barbar.nvim exposes any way to get or set the buffer order?

The only means to set the buffer order currently is :BufferMoveNext and :BufferMovePrevious. We don't provide a way to get the buffer order (IIRC), though I don't see why we couldn't provide an :ls which respects buffer order (:BufferList?).

I take it it's using its own variables to track [buffer order] because :ls and vim.api.nvim_list_bufs() always shows the same buffer order.

The buffer order is currently located here (the order of all buffers) and here (the order of all buffers configured to be visible in the tabline).

@Iron-E
Copy link
Collaborator Author

Iron-E commented Mar 28, 2024

I can reproduce the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant