romgrk / barbar.nvim

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

Can't un-highlight gitsigns icons in active buffer #504

Closed pabloqpacin closed 1 year ago

pabloqpacin commented 1 year ago

Please see the relevant barbar configuration:

require('barbar').setup {
    tabpages = true,
    highlight_visible = false,
    icons = { gitsigns = {
        added = {enabled = true, icon = '+'},
        changed = {enabled = true, icon = '~'},
        deleted = {enabled = true, icon = '-'},
    }}
}

Now the issue is that the gitsigns icons are highlighted in the active buffer, as showcased in the screenshot below.

After reading through the project documentation I have tried a few tweaks but none seem to work. It might be due to my colorscheme or gitsigns itself because I don't know what else to try in regards to the setup configuration. I might be overlooking something.

barbar-issue

Also the tabpages feature does not seem to work either unfortunately. Thank you for this awesome plugin tho!

Informations

Iron-E commented 1 year ago

Thanks for the report. I have a few questions:

Also the tabpages feature does not seem to work either unfortunately

The tabpages feature refers to Vim's tabs (not buffers), it should appear if you do e.g. :tabnew (🤞)

pabloqpacin commented 1 year ago

Thanks for your interest! Answering to your questions:


That being said, today I'll be trying to replicate my current barbar and gitsigns config with my previous rose-pine colorscheme to see if the colorscheme actually impacts this issue. Will share the outcome in this thread if that's ok. Thanks for pointing out the tabpages bit! It works perfectly with :tabnew 🥇

pabloqpacin commented 1 year ago

Update

As mentioned earlier, I've tried the same config with the 'rose-pine` colorscheme and now it works like a charm, in both the Gnome terminal and Alacritty in my PopOS vm.

barbar-no-issue

These days I'll be trying to tweak my current colorscheme to see if I figure out what causes the issue and again I'll be updating this thread if that's ok.

Iron-E commented 1 year ago

Something like this might help

pabloqpacin commented 1 year ago

Thank you @Iron-E. I've been trying to replicate and adapt the solution to those related issues (357 and #282) but my issue remains. After some testing with other colorschemes and configs, I realized that the issue is likely to be the colorscheme rather than barbar so I've created an issue for onedark as you can see above.

Also it might be of interest the fact that onedark has specific config for barbar (although I don't quite know the implications):

hl.plugins.barbar = {
    BufferCurrent = { fmt = "bold" },
    BufferCurrentMod = { fg = c.orange, fmt = "bold,italic" },
    BufferCurrentSign = { fg = c.purple },
    BufferInactiveMod = { fg = c.light_grey, bg = c.bg1, fmt = "italic" },
    BufferVisible = { fg = c.light_grey, bg = c.bg0 },
    BufferVisibleMod = { fg = c.yellow, bg = c.bg0, fmt = "italic" },
    BufferVisibleIndex = { fg = c.light_grey, bg = c.bg0 },
    BufferVisibleSign = { fg = c.light_grey, bg = c.bg0 },
    BufferVisibleTarget = { fg = c.light_grey, bg = c.bg0 },
}
Iron-E commented 1 year ago

I saw your screenshot in https://github.com/navarasu/onedark.nvim/issues/167#issue-1730785205 and just want to double check that you've tried the groups BufferCurrentADDED, BufferCurrentCHANGED and BufferCurrentDELETED specifically

pabloqpacin commented 1 year ago

THANK YOU! Problem solved. Now bg overrides the light_grey highlight while fg provides the green/blue/red colors meant for the gitsigns info.

vim.api.nvim_create_autocmd('Colorscheme', {
    group = vim.api.nvim_create_augroup('config_custom_highlights', {}),
    callback = function()
      -- Override colorscheme settings before the colorscheme 'load()' call
      vim.api.nvim_set_hl(0, 'BufferCurrentADDED',   {bg = '#020508', fg = '#7EA662'})
      vim.api.nvim_set_hl(0, 'BufferCurrentCHANGED', {bg = '#020508', fg = '#4FA6ED'})
      vim.api.nvim_set_hl(0, 'BufferCurrentDELETED', {bg = '#020508', fg = '#E55561'})
    end,
})

I believe this issue can be closed. I'll update the issue on the other repository so that their maintainers can be aware and perhaps come out with an out-of-the-box solution. Thanks again.