once and for all: vim coloring on XFree86

travelgz

Registered
Hi,
I went through the results from a search on solutions to create color syntax on vim and nothing was concrete or worked. I am wondering if there's an FAQ for something like that. I have given up trying to get color to show on vim when running on the Terminal.app (even though color shows when I telnet to a Linux machine). I have now XDarwin, and color coding works with gvim. But it still refuses to work on just plain old vim. When syntax is on, I get bold and underline text instead of colors.

Can some one please give me some concrete directions as to how to make vim (not gvim) show colors when syntax is on? Either a link to some place or step by step on what to do?

Thank you!
G
 
Right, I had the same problem.
Here's how I solved it:

Copy the .termcap file I've stuck at the end of this post to your home directory in a file called ".termcap" (prefixed with a period; without the quotes).

Then add these lines to your .profile:

#####

alias ls='ls --color'

if [ $?TERM ] ; then
t="${TERM}" # save real terminal type
eval `tset -s` # set TERMCAP to color version in .termcap
export TERM="${t}" # reset to saved type
fi

#####

(The alias for ls is optional, but its a good way of quickly seeing if this has worked ;-))

Then add these lines to your .vimrc file:

" We use a vim
set nocompatible
"
" Colo(u)red or not colo(u)red
" If you want color you should set this to true
"
let color = "true"
"
if has("syntax")
if color == "true"
" This will switch colors ON
so ${VIMRUNTIME}/syntax/syntax.vim
else
" this switches colors OFF
syntax off
set t_Co=0
endif
endif

" end .vimrc


Performing those three tasks above meant I had colour in the terminal and colour syntax in vim.

Hope this works for you ;-)

C

PS: Let me know if you have trouble with the .termcap and I can mail it to you....

############ .termcap ; start copying after this line
d0|vt100|vt100-am|vt100am|dec vt100:\
:pa#64:Co#8:Sf=\E[3%dm:Sb=\E[4%dm:eek:p=\E[m:AF=\E[3%dm:AB=\E[4%dm:\
:do=^J:co#80:li#24:cl=\E[;H\E[2J:sf=2*\ED:\
:le=^H:bs:am:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\
:ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\
:md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:\
:rf=/usr/share/tabset/vt100:\
:rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[;r\E[0m\E(B\E)B\E[2J:\
:ks=\E[?1h\E=:ke=\E[?1l\E>:\
:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
:ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=2*\EM:vt#3:xn:\
:sc=\E7:rc=\E8:cs=\E[%i%d;%dr:
dl|vt200|vt220|vt200-js|vt220-js|dec vt200 series with jump scroll:\
:im=\E[4h:ei=\E[4l:mi:dc=\E[P:dm=:ed=:al=\E[L:dl=\E[M:\
:cs=\E[%i%d;%dr:sf=\ED:sr=\EM:sb=\EM:\
:ce=\E[K:cl=\E[H\E[J:cd=\E[J:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\
:so=\E[7m:se=\E[27m:us=\E[4m:ue=\E[24m:\
:md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:\
:tc=vt100:
 
Code:
############ .termcap ; start copying after this line
d0|vt100|vt100-am|vt100am|dec vt100:\
    :pa#64:Co#8:Sf=\E[3%dm:Sb=\E[4%dm:op=\E[m:AF=\E[3%dm:AB=\E[4%dm:\
    :do=^J:co#80:li#24:cl=\E[;H\E[2J:sf=2*\ED:\
    :le=^H:bs:am:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\
    :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\
    :md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:\
    :rf=/usr/share/tabset/vt100:\
    :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[;r\E[0m\E(B\E)B\E[2J:\
    :ks=\E[?1h\E=:ke=\E[?1l\E>:\
    :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
    :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=2*\EM:vt#3:xn:\
    :sc=\E7:rc=\E8:cs=\E[%i%d;%dr:dl|vt200|vt220|vt200-js|vt220-js|dec vt200 series with jump scroll:\
    :im=\E[4h:ei=\E[4l:mi:dc=\E[P:dm=:ed=:al=\E[L:dl=\E[M:\
    :cs=\E[%i%d;%dr:sf=\ED:sr=\EM:sb=\EM:\
    :ce=\E[K:cl=\E[H\E[J:cd=\E[J:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\
    :so=\E[7m:se=\E[27m:us=\E[4m:ue=\E[24m:\
    :md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:\
    :tc=vt100:
 
what I ended up doing is using GLterm.. it supports color syntax with no config hacking.

eric
 
Originally posted by cavneb
what I ended up doing is using GLterm..
GLterm ownz.. :D It's one of those programs worth registering, even if it doesn't support transparent terminals (yet? ;)).
 
Using Terminal 1.3, Mac OSX 10.2 (jaguar) and the bash shell, this worked for me fine:

Create a file in your home directory called ".vimrc". Enter the following 2 lines:

set term=builtin_beos-ansi
syntax on


After this, whenever i Vim, it shows color syntax.

:p

eric
 
Back
Top