romgrk / barbar.nvim

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

A new tab created when opening terminal #557

Closed swahpy closed 3 months ago

swahpy commented 3 months ago

Hi all,

I have some keymaps about opening terminal shown as below in the screenshot. When I open a terminal using space + t or space + vt, a new tab will be created. In this case it is the buffer with index 3. Is this an expected behavior? May I ask is there a way to avoid the creation of the new tab? Besides, if I don't split the screen, then there is only a new tab is created. Thank you in advacne for any hints. Screenshot 2024-03-20 at 14 19 31

romgrk commented 3 months ago

Yes it's expected, you can avoid creating tabs by setting set nobuflisted on buffers that shouldn't be listed.

Iron-E commented 3 months ago

We also have the exclude_ft and exclude_name options that may help

swahpy commented 3 months ago

We also have the exclude_ft and exclude_name options that may help

Thank you for your update. Unfortunately it didn't work even I set exclude_ft = { 'terminal' }. I think the filetype for terminal is terminal, please correct if I'm wrong.

romgrk commented 3 months ago

That's something you need to validate. Check echo &ft while on the terminal window.

Fwiw I think set nobuflisted is the best solution, it's the native mechanism in vim and it's exposed to all plugins. For example, a buffer picker plugin would also use that information. You can use your $VIMRC/after/ftplugin/{filetypename}.vim to configure your filetype specific vim options.

Iron-E commented 3 months ago

Closing for now, these solutions should cover this particular use case 🙂