On Fri, Apr 03, 2009 at 04:42:39AM +0200, Tony Mechelynck wrote:
> On 03/04/09 04:10, Taylor Venable wrote:
> > I have an xterm compiled with 256 color support.  In Vim 7.2.88 after
> > it loads up I can do :set t_Co to find that 256 color support is being
> > found correctly (TERM = xterm-color).  However, I cannot figure out
> > how to determine whether 256 colors are supported on startup, as the
> > value of t_Co is 8 at the time my .vimrc is loaded.
> >
> > I've tried a few autocommands, such as VimEnter and TermChanged but
> > the value of t_Co in both of them is still 8, rather than the 256 I
> > expect.  At what point does t_Co get set to reflect the capabilities
> > of the terminal, and how can I detect it during startup?
> 
> Before sourcing your vimrc, Vim sets t_Co to the number of colors it 
> "thinks" your terminal has, according to $TERM and the (usually 
> built-in) termcap for that terminal. For an xterm-color this usually 
> means 8, as you noticed. If you are somehow certain that your terminal 
> supports more colors, you can set t_Co yourself.

The backstory is that OpenBSD's xterm-color entry in the termcap
database has Co = 8 (not sure if this is just plain 8 or 8-bit but I
assume the former).  This is because the xterm that comes in OpenBSD
core doesn't have 256 color support compiled in.  I wanted it so I
compiled my own xterm from source that *does* have 256 color support.
When I start Vim (with TERM=xterm-color) it is somehow able to figure
this out, but at some point *after* .vimrc is loaded.  So if you put
'echo &t_Co' in the .vimrc I see 8 printed, but once Vim has started
if I type ':set t_Co' then I see 256.  Also, color schemes like lucius
work and look great, I'm just trying to figure out when t_Co takes on
the 256 value so I can step in after that to set an appropriate color
scheme if the terminal supports such a wide variety of pretty colors.

-- 
Taylor Christopher Venable
http://real.metasyntax.net:2357/

((λ x . x x) (λ x . x x))

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

Reply via email to