2015-04-07 88 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