/ nvim / lua / plugins / indent.lua
indent.lua
 1  --- Indent blankline + rainbow-delimiters. Customizations from original Lazy spec.
 2  return {
 3    specs = {
 4      { src = 'https://github.com/HiPhish/rainbow-delimiters.nvim', name = 'rainbow-delimiters.nvim' },
 5      { src = 'https://github.com/lukas-reineke/indent-blankline.nvim', name = 'indent-blankline.nvim' },
 6    },
 7    config = function()
 8      local ibl = require('ibl')
 9      if type(ibl) ~= 'table' or not ibl.setup then
10        return
11      end
12      local highlight = {
13        'RainbowRed',
14        'RainbowYellow',
15        'RainbowBlue',
16        'RainbowOrange',
17        'RainbowGreen',
18        'RainbowViolet',
19        'RainbowCyan',
20        'CursorColumn',
21        'WhiteSpace',
22      }
23      local hooks_ok, hooks = pcall(require, 'ibl.hooks')
24      if hooks_ok and hooks then
25        hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
26          vim.api.nvim_set_hl(0, 'RainbowRed', { fg = '#E06C75' })
27          vim.api.nvim_set_hl(0, 'RainbowYellow', { fg = '#E5C07B' })
28          vim.api.nvim_set_hl(0, 'RainbowBlue', { fg = '#61AFEF' })
29          vim.api.nvim_set_hl(0, 'RainbowOrange', { fg = '#D19A66' })
30          vim.api.nvim_set_hl(0, 'RainbowGreen', { fg = '#98C379' })
31          vim.api.nvim_set_hl(0, 'RainbowViolet', { fg = '#C678DD' })
32          vim.api.nvim_set_hl(0, 'RainbowCyan', { fg = '#56B6C2' })
33        end)
34      end
35      vim.g.rainbow_delimiters = { highlight = highlight }
36      ibl.setup({
37        indent = { highlight = highlight, char = '┊', tab_char = '|' },
38        scope = { enabled = false, show_start = false, show_end = false, highlight = highlight },
39        whitespace = { remove_blankline_trail = false },
40        exclude = {
41          filetypes = {
42            'NvimTree',
43            'Trouble',
44            'dashboard',
45            'git',
46            'help',
47            'markdown',
48            'notify',
49            'packer',
50            'terminal',
51            'undotree',
52          },
53          buftypes = { 'terminal', 'nofile', 'prompt', 'quickfix' },
54        },
55      })
56    end,
57  }