Vim 不显示颜色

Vim doesn't display colors

我 运行 一个 Debian 7.8 服务器,安装了我能想到的所有 vim 个软件包。

我的 .profile 包含:

if [ -e /usr/share/terminfo/x/xterm-256color ]; then
        export TERM='xterm-256color'
else
        export TERM='xterm-color'
fi

我的 .vimrc 包含:

set t_Co=256
set t_AB=^[[48;5;%dm
set t_AF=^[[38;5;%dm

然而,当我打开一个随机的 cpp 文件并设置 :syntax 时,我没有得到任何颜色,但是这个:

^[[38;5;14m//#include <unistd.h>
^[[38;5;81m#include ^[[38;5;13m"bouchonWifi.h"
^[[38;5;81m#include ^[[38;5;13m"string.h"

我已经检查过我的终端可以显示颜色,这要归功于显示所有 256 种颜色的 perl 脚本,ls 是彩色的...

如何让颜色在 vim 中正确显示?

尝试 this:

if !has("gui_running")
    if &term == 'dterm'
        set tsl=0 " Sun's terminal sucks bigtime
    elseif has("terminfo") && ! (&term == 'linux' || &term == 'Eterm' || &term == 'vt220' || &term == 'nsterm-16color' || &term == 'xterm-16color')
        " Force these terminals to accept my authority! (default)
        " number of colors
        set t_Co=16
        " ANSI background
        set t_AB=^[[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm
        " ANSI foreground
        set t_AF=^[[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm
    elseif &term == 'term' || &term == 'rxvt' || &term == 'vt100' || &term == 'screen'
        " Less-Cool Terminals (no terminfo)
        set t_Co=16
        set t_AB=^[[%?%p1%{8}%<%t4%p1%d%e%p1%{32}%+%d;1%;m
        set t_AF=^[[%?%p1%{8}%<%t3%p1%d%e%p1%{22}%+%d;1%;m
    else
        " Terminals that have trustworthy terminfo entries
        if &term == 'vt220'
            set t_Co=8
            " foreground
            set t_Sf=^[[3%dm
            " background
            set t_Sb=^[[4%dm
        elseif $TERM == 'xterm'
            set term=xterm-color
        endif
    endif
endif


" enable filetype detection
if version >= 600
    filetype plugin indent on
else
    filetype on
endif
" make sure we have colors first
if &t_Co > 2 || has("gui_running")
    syntax on
endif