akinsho / akinsho/bufferline.nvim

[Bug]: error when closing last tab

Open
#1,014 0 comments 0 reactions 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?

When using bufferline in `mode='tabs'`, closing the last tab (with the x-icon on the tab) shows an error message. (Because the last tab page cant be closed with `tabclose`)

### What did you expect to happen?

I expected to have an empty/new buffer left (and close all my other buffers from that tab).
OR
To not see an x icon at all.

### Config

With lazyvim:
```lua
return {
'akinsho/bufferline.nvim',
version = "*",
dependencies = {
'nvim-tree/nvim-web-devicons',
},
config = function()
vim.opt.termguicolors = true
require("bufferline").setup {
options = {
mode = 'tabs'
}
}
end,
}
```

### Additional Information

The error message:
```lua
E5108: Error executing lua vim/_editor.lua:0: nvim_exec2(), line 1: Vim(tabclose):E784: Cannot close last
tab page
stack traceback:
[C]: in function 'nvim_exec2'
vim/_editor.lua: in function 'cmd'
.../nvim/lazy/bufferline.nvim/lua/bufferline/utils/init.lua:169: in function 'command'
...re/nvim/lazy/bufferline.nvim/lua/bufferline/commands.lua:42: in function 'handle_user_command'

...re/nvim/lazy/bufferline.nvim/lua/bufferline/commands.lua:62: in function <...re/nvim/lazy/buff
erline.nvim/lua/bufferline/commands.lua:59>
```

### 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.