Monday, November 4, 2013

Re: 't_Co' is always set to 256 if 'nocompatible' is set

Hey,

first of all, thanks for your detailed and very helpful post :)


On Monday, November 4, 2013 2:14:24 AM UTC+1, Tony Mechelynck wrote:
> The colours Vim uses depend on its colorscheme. If you don't set any,
> you get the default colours, which use only the 16 color codes
> compatible with any color depth (or maybe even 16 foreground and 8
> background colours; there are still some consoles in use today which
> don't go higher than that).

Hmm, are you sure about this? At least on my system the default colorscheme
uses more than 16 colors if t_Co is set high enough:

:colorscheme
default

:highlight


> To display more than 16 colours on a console in Vim, you need a
> colorscheme which defines highlights with ctermfg= and/or ctermbg=
> values higher than 15, and those who do may assume that the user knows
> hat he's doing, and not check that t_Co is high enough (they could test
> if they wanted to).

Like stated above, the default colorscheme also does this.

> So I think your fears are unfounded. If you don't set any colorscheme,
> or if you choose one that supports 16-color consoles, Vim won't use
> more. Of course, gvim uses all 2^24 (or 16777216) colors available on
> modern color graphic displays.
>
>
>
> However, even so, you can force Vim to ignore the t_Co value returned by
> the xterm, as follows (untested):
>
> :autocmd TermResponse * set t_Co=16
>
> or even
>
> :au TermResponse * if &term ~= '^xterm-\=16'
> \ | set t_Co=16 | endif
>
>
>
> This will be triggered only when the response comes back from the xterm,
> thus not on any other terminals. The condition in the if clause means:
> if 'term' starts with "xterm16" or "xterm-16". The single quotes are
> essential in order to pass the backslash as-is to the regex engine.
>
>
>
> I'm writing this second example on two lines with \ line continuation
> for legibility, but note that continuation lines are not supported in
> 'compatible' mode. If this is a concern, you may prefer to write
> everything on one long line.

--
--
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/groups/opt_out.

No comments:

Post a Comment