luukvbaal / statuscol.nvim

Status column plugin that provides a configurable 'statuscolumn' and click handlers.
MIT License
537 stars 25 forks source link

Statuscol has hl/background enabled on default and cant set it with fillcharhl #74

Closed haShinui closed 1 year ago

haShinui commented 1 year ago

Hello So I use nvchad with nvim 0.9.1 and I use statuscol with nvim-ufo. I have themes in nvChad and for some reason it takes the second item from M.base_16 { base00 = "#fasdfa", base01 = "#something"} color, when is set base01 to another name the color stays, but if I set the second item of M.base_16 empty string then the hl/background is gone. my config in my plugin.lua of nvchad is:

{
  "kevinhwang91/nvim-ufo",
  event = "VeryLazy",

  init = function()
    vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
    vim.o.foldcolumn = '1' -- '0' is not bad
    vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
    vim.o.foldlevelstart = 99
    vim.o.foldenable = true
  end,
  dependencies = {
      "kevinhwang91/promise-async",
      {
        "luukvbaal/statuscol.nvim",
        config = function()
          local builtin = require("statuscol.builtin")
          require("statuscol").setup({
            relculright = true,
            fillcharhl = "",
            segments = {
              { text = { builtin.foldfunc }, click = "v:lua.ScFa" },
              { text = { "%s" }, click = "v:lua.ScSa" },
              { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
            },
          })
        end,
      },
    },

and here is the color/theme lua file:

local M = {}

M.base_30 = {
  white = "#c7b89d",
  darker_black = "#1a1d1e",
  black = "#1e2122", --  nvim bg
  black2 = "#242728",
  one_bg = "#282b2c",
  one_bg2 = "#393c3d",
  one_bg3 = "#404344",
  grey = "#484b4c",
  grey_fg = "#575a5b",
  grey_fg2 = "#545758",
  light_grey = "#606364",
  red = "#ec6b64",
  baby_pink = "#ce8196",
  pink = "#ff75a0",
  line = "#323536", -- for lines like vertsplit
  green = "#89b482",
  vibrant_green = "#a9b665",
  nord_blue = "#6f8faf",
  blue = "#6d8dad",
  yellow = "#d6b676",
  sun = "#d1b171",
  purple = "#9385b4",
  dark_purple = "#887aa9",
  teal = "#749689",
  orange = "#e78a4e",
  cyan = "#82b3a8",
  statusline_bg = "#222526",
  lightbg = "#2d3031",
  pmenu_bg = "#89b482",
  folder_bg = "#6d8dad",
}

M.base_16 = {
  base00 = "#1e2122",
  base01 = "2d3031", -- This one is the culprit
  base02 = "#36393a",
  base03 = "#404344",
  base04 = "#d4be98",
  base05 = "#c0b196",
  base06 = "#c3b499",
  base07 = "#c7b89d",
  base08 = "#ec6b64",
  base09 = "#e78a4e",
  base0A = "#e0c080",
  base0B = "#a9b665",
  base0C = "#86b17f",
  base0D = "#7daea3",
  base0E = "#d3869b",
  base0F = "#d65d0e",
}

M.type = "dark"

M = require("base46").override_theme(M, "gruvchad")

return M

image

I want to keep the base01 color if possible in the case some other plugin or whatever uses it.

fr0stf0x commented 1 year ago

having the same issue when using ufo and statuscol with nvchad. I found out that there is a line in this file ~/.local/share/nvim/lazy/base46/integrations/defaults.lua. It maybe the reason why FoldColumn using the base01 color

FoldColumn = {
    fg = theme.base0C,
    bg = theme.base01,
  },

I changed to

FoldColumn = {
    fg = theme.base0C,
    bg = theme.black,
  },

And it works!.

Update: You dont need to update the ~/.local/share/nvim/lazy/base46/integrations/defaults.lua file. Just update /.config/nvim/lua/custom/highlight.lua like so

-- To find any highlight groups: "<cmd> Telescope highlights"
-- Each highlight group can take a table with variables fg, bg, bold, italic, etc
-- base30 variable names can also be used as colors

local M = {}

---@type Base46HLGroupsList
M.override = {
  Comment = {
    italic = true,
  },
  FoldColumn = {
    bg = "black",
  },
}
luukvbaal commented 1 year ago

Yes, the FoldColumn highlight group is applied to the built-in fold segment.

@fr0stf0x their solution will probably work for you but more generally simply clearing the FoldColumn highlight group will make it take on the default statuscolumn highlight.