lukas-reineke / indent-blankline.nvim

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

How to change the highlight color for indent line of the current context ? #765

Closed adamency closed 11 months ago

adamency commented 11 months ago

I can't find the relevant information on this in the doc as all mentions of the word "context" have been removed since v3 as I can see in the commit history, and all the issues mentioning the current context are from before v3 and thus use the word "context". Consequently, I didn't manage to find the replacement for settings about the current context. Can you point me to the correct setting for this ?

PS: Basically I would like to have the same pink color you have in your screenshots for the current context but configuring with the suggested configuration from the readme gets me a grey indent line, which IIUC is a color from my colorscheme (seems to be the comment highlight), but I would like to override it for the indent line of the current context.

tmp

Danielkonge commented 11 months ago

This is not yet in the main code, but it is being worked on in #743. When that pull request is committed, you will be able to find docs about it by searching the docs for current_indent instead of context.

I have been using it for more than a week now with the changes I suggested there, and I haven't had any problems. If you want to test it out, you could use the current_indent code too by using the current-indent branch (and possibly make the suggested changes if you run into any of the edge cases in the current code).

Also there is already an issue about this: #649

adamency commented 11 months ago

@Danielkonge Thanks a lot for your detailed answer. I had already found both that open PR and your issue.

However, that's not what I'm talking about nor what I was looking for. In the meantime I have found the solution to my issue. What I wanted is actually already (or rather still) available but the config key name is not very explicit...

Here is the code I had to add:

-- in HIGHLIGHT_SETUP hook
  vim.api.nvim_set_hl(0, 'CurrentScope', { fg = "#fc5ef3" })
-- in setup{}
  scope = { highlight = 'CurrentScope' },

I then can have the current context/scope highlighted differently from the default highlights per indentation levels:

tmp

Danielkonge commented 11 months ago

Ah, I guess I was confused by you saying context and your cursor position in the picture, since multiple people have asked similar questions with current_indent in mind.