how to find out where a vim highlighting is defined?
Asked Answered
T

2

6

I'm trying to change the highlighting in vim for the highlighting group "Folded". I'm using the color scheme "koehler" and my folded lines appear in cyan on a grey background in gvim, which is completely unreadable. I thought I could edit the :highlight command responsible for this group in the koehler.vim color scheme file but there is no definition for "Folded" in that file.

I verified that I have color scheme koehler loaded:

:echo g:colors_name
koehler

Then I listed all the highlighting groups with a command I found in another post:

:so $VIMRUNTIME/syntax/hitest.vim   

Highlighting groups for various occasions
-----------------------------------------
[...]
Folded  Folded
FoldColumn  FoldColumn
[...]

The "Folded" group is shown in the ugly colors I also see in my files. The file I was editing was a "viki" file but I get exactly the same with a perl script, so the highlighting for "Folded" must be defined somewhere central. I don't have any :hilight commands in my .vimrc.

How can I find out where this group is defined?

Toul answered 22/11, 2010 at 11:58 Comment(0)
M
1

(hitest.vim doesn't tell you where anything is defined. Just what is defined and grouped.)

That looks like it's probably the default setting. You can override it in a colorscheme (the easiest way is to copy $VIMRUNTIME/colors/koehler.vim to ~/.vim/colors/koehler.vim and add the lines), like this:

hi FoldColumn      guifg=#465457 guibg=#000000
hi Folded          guifg=#465457 guibg=#000000

(That example is taken from the theme I use, molokai, which has fairly nice folding colors.)

Myrtice answered 22/11, 2010 at 12:27 Comment(2)
Thanks - yes, it seems that that is the best thing to do here. Out of curiosity: where would those defaults be defined?Toul
Trying Xavier's :verbose hi Folded, skipping the vimrc and changing the colorscheme, it claims it's set in /usr/share/vim/vim73/colors/koehler.vim, though it's not. I suspect that means it's hard-coded.Myrtice
M
17

Using

:verbose hi Folded

You should be able to display where the Folded attribute was last modified. (Usually the answer is the active colorscheme file)

Melamie answered 22/11, 2010 at 13:25 Comment(0)
M
1

(hitest.vim doesn't tell you where anything is defined. Just what is defined and grouped.)

That looks like it's probably the default setting. You can override it in a colorscheme (the easiest way is to copy $VIMRUNTIME/colors/koehler.vim to ~/.vim/colors/koehler.vim and add the lines), like this:

hi FoldColumn      guifg=#465457 guibg=#000000
hi Folded          guifg=#465457 guibg=#000000

(That example is taken from the theme I use, molokai, which has fairly nice folding colors.)

Myrtice answered 22/11, 2010 at 12:27 Comment(2)
Thanks - yes, it seems that that is the best thing to do here. Out of curiosity: where would those defaults be defined?Toul
Trying Xavier's :verbose hi Folded, skipping the vimrc and changing the colorscheme, it claims it's set in /usr/share/vim/vim73/colors/koehler.vim, though it's not. I suspect that means it's hard-coded.Myrtice

© 2022 - 2024 — McMap. All rights reserved.