On 2009-04-03, Tony Mechelynck wrote:
> On 03/04/09 04:51, Gary Johnson wrote:
> >
> > On 2009-04-02, 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?
> >
> > Vim gets it from the terminfo database for your TERM by calling
> > tgetnum("Co") if it wasn't already defined by the termcap string.
> > It does this before ~/.vimrc is read. So if the terminfo database
> > for "xterm-color" says that terminal has 256 colors, Vim should set
> > t_Co to 256. On the Red Hat system I just tried in on, however,
> > "infocomp xterm-color" says "colors#8". If you want Vim to know
> > that your terminal supports 256 colors, perhaps you should set TERM
> > to "xterm-256color".
> >
> > Or are you saying that t_Co gets set automatically somehow to 256
> > and you don't know where that is? If so, you can find out by
> > executing
> >
> > :verbose set t_Co?
> Note that in case of duplication, the built-in termcap is usually used
> in preference to the termcap or terminfo entry of the same name on disk.
>
> See :help 'ttybuiltin' for details.
Good point. There are no built-in terminals with "color" in their
names, however, so that's not where the OP is getting his t_Co
value.
> ":verbose set t_Co" will only say where it was set if a vim-script
> (including the vimrc) changed it. If it was set by the startup C code
> there's no script that can be mentioned.
True, but in that case the command will simply return the value,
which does indicate that the value was set internally and not by a
script, which is useful information.
Regards,
Gary
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---