Open romgrk opened 1 year ago
Been thinking about it, should be possible to do something like this:
--- @alias generate_offset_node fun(user_options: …): string hl, string text
--- @alias generate_buffer_node fun(index: …, bufnr: …, icons_options: …): string hl, string text
--- @class nodes
--- @field provider generate_offset_node|generate_buffer_node
--- @field priority? integer higher priority nodes get shown first (i.e. further to the left)
barbar_nodes = {
left = {}, --- left (e.g. sidebar offset)
buffers = {
left = {}, --- left edge of buffer
middle = {}, --- in the middle of the padding (e.g. filename)
right = {}, --- right edge of buffer (e.g. close button)
},
right = {}, --- right (e.g. sidebar offset)
}
We could even refactor render
to use this internal list instead of iterating over all our options even if some are disabled, and then expose api
options to insert them.
One thing I'd like is if we could give the possibility to sidebars to use their space in the barbar. We already have all the logic in place, so they could just give us a list of
{ hl: string, text: string }
(possibly including click handlers) and we'd run with it.