lukas-reineke / indent-blankline.nvim

Indent guides for Neovim
MIT License
4.16k stars 102 forks source link

Change background color from your example #841

Closed horga83 closed 7 months ago

horga83 commented 7 months ago

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 },
}
horga83 commented 7 months ago

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.

lukas-reineke commented 7 months ago

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.

horga83 commented 7 months ago

Hi and thank you for your comment.

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.  :h ibl is great but far too much info to get a simple setting enabled.

A new user to VIM/NVIM would have no clue, this is why I explained my example in detail.

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

Many thanks for your plugin.

Cheers

On Sun, 2024-02-18 at 17:45 -0800, Lukas Reineke wrote:

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. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: <lukas-reineke/indent- @.***>

lukas-reineke commented 7 months ago

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.

horga83 commented 7 months ago

Many thanks,

I appreciate your work on this and if there is anything else you can think  of that would help a new user that would be great.  

Your plugin was the very first one I tried, having never used Neovim before, so  you can imagine it is all a bit overwhelming.

Cheers

On Mon, 2024-02-19 at 18:35 -0800, Lukas Reineke wrote:

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. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: <lukas-reineke/indent- @.***>