Skip to content

Are indent lines + background colors possible? #993

@felixakiragreen

Description

@felixakiragreen

apology

Apologies, and please forgive me if this is already explained somewhere I missed.

I read through the entire :help ibl, and tried to find similar issues/examples, but couldn't find my exact request.

Currently have

So — I've managed my setup to be almost exactly how I like it:

(this is an extreme example of indentation)
Image

Desired result → 1

The only thing it's missing are the background colors of the indentation level. I discovered how you can can do it, but it seems to be mutually exclusive with indentation guides (because of setting highlight of indent & whitespace) which then stops the lines from working.

Is there a way to do both? It's okay if not, I was just trying to replicate my VSCode setup, since I really liked that one.

Desired result → 2 (Found the solution ✅ )

An alternative I would be interested in would be to dim the indent lines, that are out of scope. Kind of like this:
Image

Edit: got it working!
Image
solution:

config = function()
	local highlightLines = {
		'RainbowRed',
		-- ... and so on for the other colors
	}
	local highlightDimLines = {
		'RainbowDimRed',
		-- ... and so on for the other colors
	}
	local hooks = require 'ibl.hooks'

	hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
		vim.api.nvim_set_hl(0, 'RainbowRed', { fg = felixai.red400 })
		-- ... and so on for the other colors
	end)

	vim.g.rainbow_delimiters = { highlight = highlightLines }

	require('ibl').setup { 
		indent = {
			highlight = highlightDimLines,
			char = '',
			tab_char = '',
		},
		scope = {
			highlight = highlightLines,
			char = '',
		}
	}
end,

I will update this issue and close when I figure out how to do these things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions