lukas-reineke / indent-blankline.nvim

Indent guides for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change background color from your example

horga83 opened this issue · comments

In your example on the github page you give this setup. How would one change the foreground color?
I have tried to understand this but I am not a lua person. Would you please help. Thank you.

local highlight = {
    "CursorColumn",
    "Whitespace",
}
require("ibl").setup {
    indent = { highlight = highlight, char = "" },
    whitespace = {
        highlight = highlight,
        remove_blankline_trail = false,
    },
    scope = { enabled = false },
}

I figured this out, here is the answer:

return {
	"lukas-reineke/indent-blankline.nvim",
	main = "ibl",
	lazy = false,
	opts = {
    indent = { highlight = "VertSplit", char = "│" },
  },
}

And here is the stuff nobody seems to mention, "VertSpit" is a Vim code for character attributes. At the Vim or Nvim command line if you type ":highlight", you will see a list of all the character attributes and colors. Substitute "VertSplit" for whatever you like.
The char="|" by the way is a unicode character, go into insert mode, hit u2502 to insert it, if you want to see what code a unicode character is in Nvim, put your cursor on the character and hit ga.

I figured this out by fluke by looking at this code which gives a alternating space and shade for indent lines.

local highlight = {
    "CursorColumn",
     "Whitespace",
}

return {
  "lukas-reineke/indent-blankline.nvim",
  main = "ibl",
  lazy = false,

  opts = {
  indent = { highlight = highlight, char = "" },
     whitespace = {
        highlight = highlight,
        remove_blankline_trail = true,
     },
    scope = { enabled = true },
}

I discovered by chance that :highlight allowed one to look at the highlight attributes and I recalled seeing "CursorColumn" in the list.
Hope this helps everyone with some solid information. Too much assumption these days in docs.

There is an example in the readme that shows how to set custom highlight groups

Too much assumption these days in docs.

Did you read :help ibl? Everything is explained there in a lot more detail.

I don't believe anywhere in :help ibl does it explain that if you type
:highlight in nvim it will display all the vars and their current
setting.

True, that is because :highlight is not a command of IBL. It is a built-in Neovim command.
It's not possible to explain every built-in command in the plugin doc again. They are already documented by Neovim itself.

:help ibl.config.indent.highlight tells you it expects a highlight group, or a list of highlight groups. If you don't know what that is, you can just do :help highlight-group, or :help highlight.

You can also use :help CTRL-] on underlined text in the docs and jump to the definition.

There is also :help :helpgrep that lets you grep for documentation. And there are plugins that let you fuzzy search documentation with previews, like FZF and telescope.

The Neovim help docs are very good. It pays off getting good at using them.

I'm a firm believer in the math textbook principle, a complete example
goes a long way.

I don't disagree. That's why there are multiple ready-made config examples in the README. And a lot of the settings have examples in the documentation.

I'm not saying IBLs documentation is perfect, it can always be better. I will add an explicit link to the highlight group docs from ibl.config.whitespace.highlight.
But other than that, I'm not really sure what else I can realisticly improve.