Closed linrongbin16 closed 1 month ago
Your question helped me and maybe it will help you, too (I didn't know about bufferline 'til a few minutes ago).
I have been bouncing between barbar and cokeline (and their respective GitHub communities) for several weeks now, trying to get hover, tab drag, and LSP symbols in the tabs, all to no avail.
After minimal searching (30-45 minutes vs. hours and weeks), I was able to get bufferline to do what I could not get these other 2 to do.
YMMV.
Pretty animations. Cool name.
I don't use fancy features like LSP symbols and mouse stuff, so it has gotten less attention than bufferline on that front. Bufferline is a good plugin, I'd probably use it if I didn't have barbar. But I want my pretty animations.
I consistently got this within LazyVim when trying to drag and reorder tabs:
Error executing vim.on_key Lua callback: vim/_editor.lua:0: Error executing 'on_key' with ns_ids '20'
Messages: ....local/share/nvim/lazy/barbar.nvim/lua/barbar/events.lua:108: attempt to index field 'buffers' (a nil value)
stack traceback:
[C]: in function 'error'
vim/_editor.lua: in function <vim/_editor.lua:0>
No matter how simple the plugin config was, this won't work for me with most plugins in vim 0.10.0 nightly or 0.9.5.
Hopefully I can provide additional clarification:
barbar
seems doesn't support different separator styling, whilebufferline
provide:slant
,padded_slant
,padded_slope
, etc. - Updated: I foundbarbar
also support some separator stylings now.
barbar
does provide different separator styling, and we have several layers of granularity here:
-- Use a preset to achieve commonly-desired looks
require('barbar').setup { icons = { preset = 'slanted' } }
-- Customize appearance of icons individually
require('barbar').setup {
-- the default separators
separator = { left = '/', right = '\\', },
-- the default separators of modified and pinned buffers
modified = { --[[ separator = { … } ]] },
pinned = { --[[ separator = { … } ]] },
-- the separators for alternate, current, inactive, and visible buffers
alternate = { --[[ modified = { separator = { … } }, pinned = { separator = { … } }, separator = { … } ]] },
current = { --[[ modified = { separator = { … } }, pinned = { separator = { … } }, separator = { … }, ]] },
inactive = { --[[ modified = { separator = { … } }, pinned = { separator = { … } }, separator = { … }, ]] },
visible = { --[[ modified = { separator = { … } }, pinned = { separator = { … } }, separator = { … }, ]] },
}
barbar
always render file type icon with the icon color fromnvim-web-devicons
library, whilebufferline
will make it grey/dim for those in-active buffers/tabs (butbufferline
allow user customize it).
This is also customizable in barbar, for example:
require('barbar').setup {
icons = {
filetype = {
custom_colors = true,
enabled = true,
},
},
}
-- choose the icon color for current, alternate, visible, and inactive buffers
vim.api.nvim_set_hl(0, 'BufferAlternateIcon', { … })
vim.api.nvim_set_hl(0, 'BufferCurrentIcon', { … })
vim.api.nvim_set_hl(0, 'BufferInactiveIcon', { … })
vim.api.nvim_set_hl(0, 'BufferVisibleIcon', { … })
I have been bouncing between barbar and cokeline (and their respective GitHub communities) for several weeks now, trying to get hover, tab drag, and LSP symbols in the tabs, all to no avail.
barbar.nvim
does not support tab hover currently, though I'd be glad to help get any other features working if there are problems :)
I consistently got this within LazyVim when trying to drag and reorder tabs:
Seems there has been a regression since that was implemented, will have a fix shortly.
Edit: seems to have regressed in #573
Merged a PR which should fix the issue reported in https://github.com/romgrk/barbar.nvim/issues/576#issuecomment-2110057105
Works beautifully now, thank you!
hi, what's the difference between this plugin and bufferline.nvim? Since I feel they look quite close to each other?
Actually I have been use
barbar.nvim
several months (maybe over a year, I don't remember), then I switched tobufferline.nvim
. the differences I could tell are:Update: I foundbarbar
seems doesn't support different separator styling, whilebufferline
provide:slant
,padded_slant
,padded_slope
, etc.barbar
also support some separator stylings now.Update: I foundbarbar
always render file type icon with the icon color fromnvim-web-devicons
library, whilebufferline
will make it grey for those in-active buffers/tabs.barbar
also make in-active buffers file type icon color to grey now.barbar
embed thevim-bbye
plugin (known as theBdelete
andBwipeout
user command), which helps delete/wipeout a buffer without break up user's window layout.bufferline
doesn't have such commands, so user have to look for other plugins likebufdelete.nvim
orvim-bbye
.barbar
seems doesn't have theBufferLineCycleNext
andBufferLineCyclePrev
commands provided bybufferline
.Any other differences?
Update: there're two differences I have to mention, because they're the reasons I go back to
barbar
:barbar
can auto-sizing tabs width, which is really a feature I'm missing when I usebufferline
, my eyes just feel more comfortable when there's few tabs and the width becomes wider.When there're too many buffers opened,
barbar
renders the two tabs on left and right side partially and fill Neovim's tabline. Whilebufferline
will left extra spaces, I personally preferbarbar
because it provides more info (see picture below).