Friday, April 29, 2011

Re: How do define a default highlight for none-linked group?

On 30/04/11 9:52 AM, Tony Mechelynck wrote:
> On 29/04/11 04:00, pansz wrote:
>> hi vimmers,
>>
>> for linked group we can use :hi default link to set a default value, for
>> none-linked group we can't.
>>
>> Suppose my script want to set the default value highlight group
>> CursorIM. i.e. if user color scheme has set the hi CursorIM, let it be,
>> if user color scheme has not set the highlight, my script set it to a
>> specific value.
>>
>> Is it possible? or is it possible to check in script whether a highlight
>> group already defined or not?
>
> What about
> hi default CursorIM term=reverse ctermbg=green ctermfg=yellow
> \ gui=bold guibg=green guifg=yellow
>
> I don't have a help tag but see line 4087 of syntax.txt (2011 Apr 06
> for Vim 7.3).

Well, the 'default' part is explained at :help :hi-default which applies
not just to :hi-link, which is closest to it, and which the examples
demonstrate, but it also applies to :hi with settings (as [default] is
present in the syntax description, and there is a cross-reference to
:help :highlight-default, a little bit below :help :colo).

However, it doesn't really help in this case. CursorIM, being a built-in
highlight group, never has "no settings" or "doesn't exist", unless you
explicitly do :hi clear CursorIM or :hi CursorIM NONE. So using
"default" to define CursorIM will be useless unless you expect your user
to do one of those two things above if they want to get your default
highlighting.

Ben.

--
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:

Post a Comment