romgrk / barbar.nvim

The neovim tabline plugin.
2.26k stars 85 forks source link

[Feature Request] Git indicators #460

Closed meseck closed 1 year ago

meseck commented 1 year ago

It would be nice to have some optional git indicators, similar to what the plugin already does for the lsp diagnostics.

Please let me know if this could be part of the plugin. I would like to give it a try and open a PR for this feature. Thanks!

Iron-E commented 1 year ago

Gitsigns exposes a vim.b.gitsigns_status_dict, and emits an autocommand when it is updated. That'd probably be the easiest way.

meseck commented 1 year ago

I thought of that too, that is exactly what I do in my lualine configuration. But that would make gitsigns a dependency.

Maybe this lualine approach for custom sections (indicators in our case) would be a better approach? That way everyone can pass what they want after the filename.

The git indicators could then be an example in the documentation.

What do you think? :)

Iron-E commented 1 year ago

We have #426 open for a custom sections API (still a WIP, we want to stabilize these latest few changes first).

We could always make a default gitsigns section (just to minimize the code in the repo) and let people write a custom one later, if they wish.

People can always skip the gitsigns dep if they use a custom section and/or disable the builtin git section, we do something similar for nvim-web-devicons.


If you want to write a PR, the files you'll want to take a look at are:

Something similar in structure to icons.diagnostics would probably work, i.e.

icons = { 
  git = {
    enabled = true,
    added = '<added icon>',
    -- … changed/deleted,etc
  },
  current = {git = {enabled = false}},
}
Iron-E commented 1 year ago

Closed by #463