akinsho / akinsho/bufferline.nvim

[Bug]: When using sort_by 'insert_after_current' buffer ordinal number are no updated

Open
#976 2 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Lua
Stars
4.4k
Forks
240
PR merge metrics
No merged PRs in 30d

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### What happened?

I have numbers set to show ordinal number.

```lua
numbers = function(opts)
return string.format("%s", opts.lower(opts.ordinal))
end,
```

and set `sort_by` to `insert_after_current`

In this video, when a move to ordinal `1`, and open `init.lua`, buffer `init.lua` has ordinal `2` but it's showing `3`.

https://github.com/user-attachments/assets/71caf822-bce7-4a14-be24-1aa07144cacb

you can see when I go to ordinal `2` it goes to the right buffer, but the ordinal number is not refreshing.

lua require("bufferline").go_to_buffer(2, true)

### What did you expect to happen?

Expected behaviour should be refresh the ordinal number

### Config

```lua
return {
"akinsho/bufferline.nvim",
branch = "main",
dependencies = "nvim-tree/nvim-web-devicons",
init = function()
require("bufferline").setup({
options = {
mode = "buffers",
themable = true,
numbers = function(opts)
return string.format("%s", opts.lower(opts.ordinal))
end,
sort_by = 'insert_after_current',
},
})
end,
}

```

### Additional Information

...

### commit

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.