Pan 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?
> 
> It would be tedious if we need to wrap 'try..catch' on all occurrences 
> of bg, may I think that 'bg' is pretty useless?

If you have many of these you could do:

        try
          hi Something ctermbg=bg
          hi Another cterm=bg
          hi etc.
        catch /E420/
          hi Something ctermbg=NONE
          hi Another cterm=NONE
          etc.
        endtry

If you have many of them you could use :execute to avoid repeating each
hi command twice.

-- 
I'm in shape.  Round IS a shape.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

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

Reply via email to