-- indent-blankline.lua: Visualizes indentation levels with vertical guide lines.

return {
  {
    "lukas-reineke/indent-blankline.nvim",
    main = "ibl",
    event = { "BufReadPost", "BufNewFile" },
    config = function()
      -- Define highlights BEFORE setup() is called
      local function set_highlights()
        vim.api.nvim_set_hl(0, "IblIndent", { fg = "#313244" })
        vim.api.nvim_set_hl(0, "IblScope", { fg = "#5E81AC" })
      end

      set_highlights()
      vim.api.nvim_create_autocmd("ColorScheme", {
        pattern = "*",
        callback = set_highlights,
      })

      require("ibl").setup({
        indent = {
          char = "▏",
        },
        scope = {
          enabled = true,
          char = "▏",
          show_start = true,
          show_end = true,
        },
        exclude = {
          filetypes = {
            "help",
            "alpha",
            "dashboard",
            "lazy",
            "mason",
          },
        },
      })
    end,
  },
}
