红联Linux门户
Linux帮助

Vim代码颜色配置-PHP版

发布时间:2014-11-24 21:56:07来源:linux网站作者:luochuan

vim可以称得上是Linux系统下的编辑神器,是一款高度可定制的编辑器,用它可以打造我们自己的完美的IDE。


在_vimrc配置文件中,我们可以设置colorscheme参数来载入我们自己的颜色插件,在vim目录下的colors文件夹里面你可以看到有一些预装的颜色插件。


设置颜色插件命令:

if has("gui_running") 
set guioptions-=T 
set t_Co=256 
colorscheme laphp 
endif


修改colorscheme参数后面的值,可以载入不同的颜色配置。


由于个人是做php开发的,试用了几个颜色配置后,觉的都不适合自己,所以自己根据phpx.vim配置了一个新插件, laphp.vim


具体配置如下:

" Vim color file 
" Maintainer: buzhidao 
" Last Change:  2012 Feb 10 
" as :color ladesert 
set background=light 
 
hi clear 
 
if exists("syntax_on") 
  syntax reset 
endif 
 
let g:colors_name = "laphp" 
 
if exists("&t_Co") && &t_Co > 2 && &t_Co <= 8 
"Not much on the linux (text)console, unless anybody would document. 
hi Normal  ctermfg=4 ctermbg=7 
hi Comment ctermfg=3 
hi Constantctermfg=1 
hi Special ctermfg=3 
hi Identifier  ctermfg=4 
hi Statement   ctermfg=0 
hi PreProc ctermfg=2 
hi Typectermfg=2 
finish 
endif 
 
" LIGHT COLOR DEFINE START 
hi Normal  guifg=#008000 guibg=#FFFFFF  
hi Cursor  guifg=#ffffff guibg=#333333 
hi Comment guifg=#ff8000 guibg=bg 
hi Constantguifg=#dd0000 guibg=bg 
hi Special guifg=#0000bb guibg=bg 
hi Identifier  guifg=#0066cc guibg=bg 
hi Statement   guifg=#0000bb guibg=bg gui=NONE term=bold ctermfg=28 cterm=NONE  
hi Functionguifg=#008000 guibg=bg gui=bold 
hi Operatorguifg=#0066cc guibg=bg 
hi PreProc guifg=#0000bb guibg=bg term=underline ctermfg=34 
hi Typeguifg=#0000bb guibg=bg term=underline ctermfg=34 
hi Underlined  guifg=#80a0ff guibg=bg term=underline cterm=underline ctermfg=9 gui=underline  
hi Ignore  guifg=bg guibg=fg cterm=bold ctermfg=0  
hi Error   guifg=#ffffff guibg=#ff0000 term=reverse cterm=bold ctermfg=15 ctermbg=12  
hi Todoguifg=#0000ff guibg=#ffff00 term=standout ctermfg=0 ctermbg=14  
hi Pmenu   guibg=#ff00ff guifg=fg ctermbg=13  
hi PmenuSelguibg=#a9a9a9 guifg=fg ctermbg=8  
hi PmenuSbar   guibg=#bebebe guifg=fg ctermbg=7  
hi PmenuThumb  guifg=fg guibg=bg gui=reverse cterm=reverse  
hi TabLine guibg=#a9a9a9 guifg=fg gui=underline term=underline cterm=underline ctermfg=15 ctermbg=8  
hi TabLineSel  guifg=fg guibg=bg gui=bold term=bold cterm=bold  
hi TabLineFill guifg=fg guibg=bg gui=reverse term=reverse cterm=reverse  
hi MatchParen  guifg=#cecb00 guibg=#ffffaf term=reverse ctermfg=3 ctermbg=229  
hi SpecialKey  guifg=#00ffff guibg=bg term=bold ctermfg=9  
hi NonText guifg=#0000ff guibg=bg gui=bold term=bold ctermfg=9  
hi Directory   guifg=#d700af guibg=bg term=bold ctermfg=11  
hi ErrorMsgguifg=#ffffff guibg=#ff0000 term=standout cterm=bold ctermfg=15 ctermbg=4  
hi IncSearch   guifg=#708090 guibg=#f0e68c gui=reverse term=reverse cterm=reverse ctermfg=11 ctermbg=10  
hi Search  guifg=#000087 guibg=#ff8000 term=reverse ctermfg=18 ctermbg=122  
hi MoreMsg guifg=#00875f guibg=bg term=bold ctermfg=29 gui=bold  
hi ModeMsg guifg=#d7af00 guibg=bg term=bold cterm=bold ctermfg=178 gui=bold  
hi LineNr  guifg=#000000 guibg=bg term=underline ctermfg=186  
hi Questionguifg=#00ffff guibg=bg gui=bold term=standout ctermfg=14  
hi StatusLine  guifg=#333333 guibg=bg gui=bold,reverse term=bold,reverse cterm=bold,reverse ctermfg=18 ctermbg=15  
hi StatusLineNCguifg=#333333 guibg=bg gui=bold,reverse term=bold,reverse cterm=bold,reverse ctermfg=246 ctermbg=15  
hi VertSplit   guifg=#333333 guibg=bg gui=reverse ctermfg=18 ctermbg=251 term=reverse cterm=reverse  
hi Title   guifg=#d700af guibg=bg gui=bold term=bold ctermfg=163  
hi Visual  guifg=#316ac5 guibg=#ffffff gui=reverse term=reverse cterm=reverse ctermfg=229 ctermbg=22  
hi VisualNOS   guifg=fg guibg=bg gui=bold,underline term=bold,underline cterm=bold,underline  
hi WarningMsg  guifg=#ff0000 guibg=bg term=standout ctermfg=9  
hi WildMenuguifg=#000000 guibg=#ffff00 guifg=fg term=standout ctermfg=0 ctermbg=11  
hi Folded  guifg=#00ffff guibg=#a8a8a8 term=standout ctermfg=14 ctermbg=248  
hi FoldColumn  guifg=#ffffff guibg=#333333 term=standout ctermfg=14 ctermbg=250  
hi DiffAdd guibg=#000087 guifg=#e4e4e4 term=bold ctermbg=1 ctermbg=18 ctermfg=254  
hi DiffChange  guibg=#870087 guifg=#87afff term=bold ctermbg=90  
hi DiffDelete  guifg=#0000ff guibg=#008787 gui=bold term=bold cterm=bold ctermfg=21 ctermbg=30 ctermbg=3  
hi DiffTextguibg=#ff0000 guifg=fg gui=bold term=reverse cterm=bold ctermbg=9  
hi SignColumn  guifg=#00ffff guibg=#bcbcbc term=standout ctermfg=14 ctermbg=250  
hi lCursor guifg=#d7ffd7 guibg=#0000af 
" LIGHT COLOR DEFINE END 
 
"finish 
 
" DARK COLOR DEFINE START 
hi Normal  guifg=#909090 guibg=#131313 ctermfg=19 ctermbg=254  
hi Cursor  guifg=#131313 guibg=#909090  
hi Comment guifg=#e4e4e4 guibg=bg ctermfg=208  
hi Constantguifg=#dd0000 guibg=bg ctermfg=160  
hi Special guifg=#00af00 guibg=bg term=bold ctermfg=166  
hi Identifier  guifg=#0066cc guibg=bg term=underline cterm=NONE ctermfg=19  
hi Statement   guifg=#00af00 guibg=bg gui=NONE term=bold ctermfg=28 cterm=NONE  
hi Functionguifg=#ff8000 guibg=bg gui=bold 
hi Operatorguifg=#0066cc guibg=bg 
hi PreProc guifg=#00af00 guibg=bg term=underline cterm=bold ctermfg=34 gui=bold  
hi Typeguifg=#00af00 guibg=bg term=underline ctermfg=34  
hi Underlined  guifg=#80a0ff guibg=bg term=underline cterm=underline ctermfg=9 gui=underline  
hi Ignore  guifg=bg guibg=fg cterm=bold ctermfg=0  
hi Error   guifg=#ffffff guibg=#ff0000 term=reverse cterm=bold ctermfg=15 ctermbg=12  
hi Todoguifg=#0000ff guibg=#ffff00 term=standout ctermfg=0 ctermbg=14  
hi Pmenu   guibg=#ff00ff guifg=fg ctermbg=13  
hi PmenuSelguibg=#a9a9a9 guifg=fg ctermbg=8  
hi PmenuSbar   guibg=#bebebe guifg=fg ctermbg=7  
hi PmenuThumb  guifg=fg guibg=bg gui=reverse cterm=reverse  
hi TabLine guibg=#a9a9a9 guifg=fg gui=underline term=underline cterm=underline ctermfg=15 ctermbg=8  
hi TabLineSel  guifg=fg guibg=bg gui=bold term=bold cterm=bold  
hi TabLineFill guifg=fg guibg=bg gui=reverse term=reverse cterm=reverse  
hi MatchParen  guifg=#cecb00 guibg=#ffffaf term=reverse ctermfg=3 ctermbg=229  
hi SpecialKey  guifg=#00ffff guibg=bg term=bold ctermfg=9  
hi NonText guifg=#0000ff guibg=bg gui=bold term=bold ctermfg=9  
hi Directory   guifg=#d700af guibg=bg term=bold ctermfg=11  
hi ErrorMsgguifg=#ffffff guibg=#ff0000 term=standout cterm=bold ctermfg=15 ctermbg=4  
hi IncSearch   guifg=#708090 guibg=#f0e68c gui=reverse term=reverse cterm=reverse ctermfg=11 ctermbg=10  
hi Search  guifg=#000087 guibg=#ff8000 term=reverse ctermfg=18 ctermbg=122  
hi MoreMsg guifg=#00875f guibg=bg term=bold ctermfg=29 gui=bold  
hi ModeMsg guifg=#d7af00 guibg=bg term=bold cterm=bold ctermfg=178 gui=bold  
hi LineNr  guifg=#909090 guibg=bg term=underline ctermfg=186  
hi Questionguifg=#00ffff guibg=bg gui=bold term=standout ctermfg=14  
hi StatusLine  guifg=#333333 guibg=#909090 gui=bold,reverse term=bold,reverse cterm=bold,reverse ctermfg=18 ctermbg=15  
hi StatusLineNCguifg=#333333 guibg=#909090 gui=bold,reverse term=bold,reverse cterm=bold,reverse ctermfg=246 ctermbg=15  
hi VertSplit   guifg=#333333 guibg=#909090 gui=reverse ctermfg=18 ctermbg=251 term=reverse cterm=reverse  
hi Title   guifg=#d700af guibg=bg gui=bold term=bold ctermfg=163  
hi Visual  guifg=#cccccc guibg=#000000 gui=reverse term=reverse cterm=reverse ctermfg=229 ctermbg=22  
hi VisualNOS   guifg=fg guibg=bg gui=bold,underline term=bold,underline cterm=bold,underline  
hi WarningMsg  guifg=#ff0000 guibg=bg term=standout ctermfg=9  
hi WildMenuguifg=#000000 guibg=#ffff00 guifg=fg term=standout ctermfg=0 ctermbg=11  
hi Folded  guifg=#00ffff guibg=#a8a8a8 term=standout ctermfg=14 ctermbg=248  
hi FoldColumn  guifg=#ffffff guibg=#333333 term=standout ctermfg=14 ctermbg=250  
hi DiffAdd guibg=#000087 guifg=#e4e4e4 term=bold ctermbg=1 ctermbg=18 ctermfg=254  
hi DiffChange  guibg=#870087 guifg=#87afff term=bold ctermbg=90  
hi DiffDelete  guifg=#0000ff guibg=#008787 gui=bold term=bold cterm=bold ctermfg=21 ctermbg=30 ctermbg=3  
hi DiffTextguibg=#ff0000 guifg=fg gui=bold term=reverse cterm=bold ctermbg=9  
hi SignColumn  guifg=#00ffff guibg=#bcbcbc term=standout ctermfg=14 ctermbg=250  
hi lCursor guifg=#d7ffd7 guibg=#0000af 
" DARK COLOR DEFINE END 
 
finish


这个配置包含两种颜色搭配,一种是白色的背景色,一种是黑色的背景色,默认配置是用黑色的背景色,如果想用白色的背景色,将light color与dark color代码块中间的finish前面的"去掉即可。