Sunday, August 12, 2018

Re: Set background and hi Normal: in which order?

On 12/08/2018 18:39, Tony Mechelynck wrote:
> On Sun, Aug 12, 2018 at 4:58 PM, Lifepillar <lifepillar@lifepillar.me> wrote:
>> Dear masters of Vim colorschemes,
>> which of the following should a dark-only colorscheme use?
>>
>> (1)
>> set background=dark
>> hi Normal ...
>> " Other highlight groups here
>>
>> (2)
>>
>> hi Normal ...
>> set background=dark
>> " Other highlight groups here
>>
>> (3)
>> hi Normal ...
>> " Don't set 'background' at all.
>> " Other highlight groups here
>>
>> I am asking because I have always used (1), but recently I have found
>> an instance (iVim for iOS, which is based on Vim 7.4.900) in which my
>> colorscheme has the wrong color for the status line. The relevant part
>> of the highlight group is defined as follows (below you find the full
>> definition):
>>
>> hi StatusLine guifg=#64878f guibg=fg gui=NONE,reverse
>>
>
> I may be wrong but I _think_ that setting gui=NONE clears (i.e. makes
> irrelevant) the guifg= guibg= settings which come before.

I have never seen it work that way. Anyway, nothing of what I have
described changes if you use gui=reverse instead of gui=NONE,reverse.

> If you want the Normal group to be set to bg=#64878f fg=#ffffff I
> would rather write
>
> hi StatusLine guibg=#64878f guifg=white
>
> which seems simplest (and clearest) to me.

Fine, but my question is different: is it true that (1), (2) and (3)
above always produce the same result? I used to think that the answer
was positive, at least for (1) and (2), but I have encountered a case
(using fg in iVim) in which there is a difference between (1) and (2).

Also, in a very old thread entitled "[BUG] Background is reset when
ctermbg for `Normal' group is redefined", Bram wrote the following
reply:

>You would normally first set the Normal
>highlighting, and if the 'background' option is then wrong correct it.
>Then set the other colors.

which makes me believe that (2) is the way to go. But that was in 2006,
and I don't know whether the advice is still valid.

Life.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: