On Wed, Mar 11, 2009 at 4:22 AM, pansz wrote:
>
> Bram Moolenaar 写道:
>> It's not like when you use "cterm=bg" that the color follows what the
>> Normal color is set to.  It just uses the current value.  And if there
>> is none at the moment it doesn't work.
>> If you don't care about the error, you could do this:
>>       try
>>         hi Something ctermbg=bg
>>       catch /E420/
>>         " Ignored
>>       endtry
>
> Since ctermbg=bg cannot work properly in this case, I've changed to use
> ctermbg=NONE for what I want and so far it seems to work. What's the
> difference between NONE and bg in my case?

If you tell the Normal group not to output a background color, you
need to tell every other highlight group that you want to match the
Normal group that it shouldn't output a background color.  ctermbg=bg
says "use the current background color", and after you did a :hi
Normal ctermbg=NONE, there is no "current background color", so
ctermbg=bg, by design, fails.

> It would be tedious if we need to wrap 'try..catch' on all occurrences
> of bg, may I think that 'bg' is pretty useless?

For the special case of not wanting any color output, it's not useful.
 For the more general case of wanting to set the default background
color in one place and having a bunch of different groups use it, it's
useful.

~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to