Sample Header Ad - 728x90

Setting indent blankline plugin in lua with custom options

0 votes
0 answers
1008 views
I do not know how to write configs in lua. I am using neovim and my configartion is written in lua. I have few plugins and I use lazy nvim as my plugin manager. I have a seperate plugins directory which holds my plugins' lua files. I currently have the below as my indent-blankline.lua file:
local Plugin = {'lukas-reineke/indent-blankline.nvim'}

Plugin.name = 'indent_blankline'

Plugin.main = 'ibl'

Plugin.event = {'BufReadPost', 'BufNewFile'}

-- See :help ibl.setup()
Plugin.opts = {
  enabled = false,
  scope = {
    enabled = false,
  },
  indent = {
    char = '▏',
  },
}

return Plugin
I want to add the config below which I found in the github page of the plugin. It will apply colors to the lines:
local highlight = {
    "RainbowRed",
    "RainbowYellow",
    "RainbowBlue",
    "RainbowOrange",
    "RainbowGreen",
    "RainbowViolet",
    "RainbowCyan",
}

local hooks = require "ibl.hooks"
-- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
    vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
    vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
    vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
    vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
    vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
    vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
    vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
end)

require("ibl").setup { indent = { highlight = highlight } }
I am not sure how/where to place the above. I wonder if someone can tell me how do I integrate this to my config.
Asked by Muzzamil (3 rep)
Oct 15, 2023, 07:09 AM