[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: vim + termcaps + colors



On Tue, 7 Oct 2003 16:25:50 -0500 (CDT), Aaron Hall
<lisps@vitaphone.net> penned:

<snip size="big"/>

> 
> The t_Co sets the number of colors your terminal supports. xterm and
> the linux console do 16 colors. The vt220 is how my OpenBSD console
> identifies itself, and it doesn't work with 16, so I set it to 8
> instead. The t_Sf and the t_Sb set the escape sequences to send to set
> the foreground and background colors, respectively. All characters are
> literal; it's should be safe to copy/paste this, and it should work
> fine in Vim 6.
> 
> A couple things I do not understand: there are also codes t_AF and
> t_AB, that seem to have the same purpose as t_Sf and t_Sb. I don't
> really understand the distinction between them. termcap(5) didn't help
> much, I'm afraid. t_Sf and t_Sb work for me, so I use them.
> 
>> [rest snipped]
> 
> I hope this is somewhat helpful.
> 
> - Aaron
> 

As I posted before, I was unable to get your fix to work.  Here's what
I've got now, which seems to work across all of the systems on which
I've used it:

if &term == "screen"
  if has("terminfo")
     set t_Co=16
     set t_AB=^[[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm
     set t_AF=^[[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm
  else
     set t_Co=16
     set t_Sf=^[[3%dm
     set t_Sb=^[[4%dm
  endif
else "cygwin, xterm, any others?
  if has("terminfo")
    set t_Co=8
    set t_Sf=^[[3%p1%dm
    set t_Sb=^[[4%p1%dm
  else
    set t_Co=8
    set t_Sf=^[[3%dm
    set t_Sb=^[[4%dm
  endif
endif

(^[ up there is a literal escape ... I think I could replace those with
the text <ESC>)

The only difference I readily notice is that comments are bright cyan in
the 8-color variations and "muted" cyan in 16-color.

I don't know why I should be able to get 16 colors working in screen but
not in the terminal from which I ran screen, but screw it.  This works
well enough.  I haven't been able to test it while actually sitting at
the machine's terminal, but I'm betting (hoping) it will work.

As for your earlier questions, according to the vim documentation, t_AF
and t_AB are ANSI.  t_sf and t_sb are, um, not.  I'm not really sure
what all that means, but fwiw, there you go.

-- 
monique
Please respond to the group OR to my email, but not both.  (Group preferred.)



Reply to: