2015-04-07 160 views
0

我运行Debian 7.8服务器,安装了我能想到的所有vim软件包。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文件,并设置:在我的语法没有得到任何颜色,但是这个:

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

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

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

+0

似乎都与t_AF有关,尝试评论t_AB和t_AF线,看看会发生什么 – vivoconunxino

+0

不改变任何事情 – Percee

+0

确保'^ ['输入为'按Ctrl -V [' – tivn

回答

0

尝试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 
+0

的某些变化: '^ [96米//#包括 ^ [94米#^包括[95米 “bouchonWifi.h” ^ [94米#^包括[95米“string.h”' 号码不一样:/ – Percee

+0

:/不知道该说什么,你可以尝试以vervose模式启动vim:vim -V9myVimLog – vivoconunxino

+0

这将创建myVimLog,你可以在你的问题中复制相关的输出 – vivoconunxino