Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose an API for custom sections #426

Open
romgrk opened this issue Apr 3, 2023 · 1 comment
Open

Expose an API for custom sections #426

romgrk opened this issue Apr 3, 2023 · 1 comment
Labels
request New feature or request
Milestone

Comments

@romgrk
Copy link
Owner

romgrk commented Apr 3, 2023

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.

@romgrk romgrk changed the title Expose an API for sidebars Expose an API for custom sections Apr 3, 2023
@Iron-E Iron-E added the request New feature or request label Apr 3, 2023
@Iron-E Iron-E added this to the 1.7 milestone Apr 9, 2023
@Iron-E
Copy link
Collaborator

Iron-E commented Apr 29, 2023

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.

@Iron-E Iron-E modified the milestones: 1.7, 1.8 Aug 26, 2023
@Iron-E Iron-E modified the milestones: 1.8, 1.9 Jun 7, 2024
@Iron-E Iron-E modified the milestones: 1.9, 1.10 Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants