romgrk / barbar.nvim

The neovim tabline plugin.
2.16k stars 81 forks source link

Can't completely close tab #534

Closed huanmoon closed 8 months ago

huanmoon commented 8 months ago

I was closing a tab with :tabclose but I can't completely close it image This is what did my editor see before closing the tab, everything is ok

image This is what did my editor see after closing the tab, it still displayed in tab bar, but I can't switch to it and it didn't display "../2" in the top-right corner

I don't know is this a bug If not, how to fix it?

Thanks in advance =)

huanmoon commented 8 months ago

I've resolved this issue by myself, the tab didn't close because I just did :tabclose but I didn't do :BufferClose

huanmoon commented 8 months ago

I've resolved this issue by myself, the tab didn't close because I just did :tabclose but I didn't do :BufferClose

Actually I didn't resolve this issue, I added map('n', '', 'BufferClose tabclose ', opts) to my config but when I press alt+w, it didn't work. It closes the buffer but sometimes it can't close the tab.

Iron-E commented 8 months ago

Just so I understand, you want a command which can close a tab and the buffer associated with it?

The problem with the mapping, I suspect, is the lack of VimL's equivalent to a semicolon (|) between statements:

map('n', '<A-w>', 'BufferClose | tabclose ', opts)

If that doesn't work, you can try:

vim.keymap('n', '<A-w>', function()
  vim.cmd.BufferClose()
  vim.cmd.tabclose()
end, opts)

The builtin :bdelete command might also just remove tabs by itself, I'm not sure. Try that as well.

huanmoon commented 8 months ago

Just so I understand, you want a command which can close a tab and the buffer associated with it?

The problem with the mapping, I suspect, is the lack of VimL's equivalent to a semicolon (|) between statements:

map('n', '<A-w>', 'BufferClose | tabclose ', opts)

If that doesn't work, you can try:

vim.keymap('n', '<A-w>', function()
  vim.cmd.BufferClose()
  vim.cmd.tabclose()
end, opts)

The builtin :bdelete command might also just remove tabs by itself, I'm not sure. Try that as well.

thanks, it works