Thursday, August 26, 2010

RE: Highlighting seems to forget values

Martin Braun wrote:
> Using this snippet in .vimrc
> colorscheme delek
> highlight WhiteSpaceEOL ctermbg=darkgreen guibg=lightgreen
> highlight OverLength ctermbg=red ctermfg=white guibg=#592929
>
> I can't use the highlight values WhiteSpaceEOL and OverLength
> anywhere.
> However, if I delete the 'colorscheme' line, I can.
>
> What I expect:
> - That I can run a command like :match OverLength <pattern> with this
> .vimrc
> What happens:
> - 'OverLength' gets forgotten somewhere and the matching works, but
> doesn't set a color

The word "forgotten" seems inappropriate since if it were
undefined, the :match command would give an error.

What does the following command show?
:hi OverLength

Sometimes when debugging weirdness, I find that putting "XX" at
the start of a keyword can be helpful, just as a sanity check
that nothing else is using the same keyword. So, if you define
XXOverLength in vimrc, is it unchanged later?

BTW if using Vim 7.2 or later, this tip is wonderful:
http://vim.wikia.com/wiki/Highlight_multiple_words

Actually, that suggestion has reminded me of something. If the
following line is executed somewhere:
:call clearmatches()

then all matches will be cleared (that is, the OverLength
highlight group would still exist, but the ':match...' would be
forgotten). Perhaps some autocommand (syntax highlighting?) is
invoking some code which includes that?

John

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: