原版配色方案无法对颜色的数量做出假设,因此他们比较保守,只期望 PC 时代的 16 种基本颜色。
在 256 色 XTerm 中为 vim 设置颜色有点复杂,但结果令人满意。这是我使用的。确保您的 XTerm 实际上是 256 色版本(默认情况下是 Ubuntu)。此设置将使 vim 和 gvim 使用相同的颜色。作为奖励,如果您已将 XTerm 配置为使用 TrueType 字体,它可以将高亮显示为斜体——请参阅白色注释(如果字体支持它;我使用*faceName: Droid Sans Mono
)。
" If the xterm supports 256 colors, make sure TERM=xterm-256color.
" If it supports 256 colors but sets TERM=xterm, edit the appropriate
" resource file (~/.Xdefaults or $XAPPLRESDIR/XTerm) and add
" *termName: xterm-256color
" For mintty, select the xterm-256color TERM value in the options menu.
if &term == "xterm-256color"
" Also for Cygwin's mintty.
set t_Co=256
elseif $PROFILE_OS == "Solaris"
set t_Co=256
elseif (&term == "xterm" || &term =~ "cons") && $TTY =~ "/dev/ttyv"
" Adjust for FreeBSD syscons with ANSI colors.
set t_Co=16
map <Esc>[2~ i
map <Esc>[3~ x
map <Esc>[5~ <C-B>
map <Esc>[6~ <C-F>
colorscheme delek
elseif &term == "cygwin"
" Adjust for Cygwin in a cmd.exe window.
set t_Co=16
colorscheme koehler
endif
"
" The cterm color numbers refer to XTerm colors in 256 color mode.
" Map rgb to cterm colors using <URL:https://gist.github.com/719710>.
" cterm=underline is rendered as italic with xterm +ulit
" gui=NONE turns off bold, italic.
"
" Normal must be set before colors "fg" and "bg" can be used.
highlight Normal ctermfg=216 ctermbg=233 guifg=#ffaf87 guibg=#121212
" pink C 'c'
highlight Character
\ cterm=NONE ctermfg=211 ctermbg=bg
\ gui=NONE guifg=#ff87af guibg=bg
" gray This comment.
highlight Comment
\ cterm=underline ctermfg=250 ctermbg=bg
\ gui=italic guifg=#bcbcbc guibg=bg
highlight ColorColumn cterm=NONE ctermfg=7 ctermbg=99 gui=NONE guifg=#c0c0c0 guibg=#875fff
" blue if/then/else/fi.
highlight Conditional
\ cterm=NONE ctermfg=27 ctermbg=bg
\ gui=NONE guifg=#005fff guibg=bg
" lightgreen Numbers and quoted strings.
highlight Constant
\ cterm=NONE ctermfg=82 ctermbg=bg
\ gui=NONE guifg=#5fff00 guibg=bg
highlight Cursor
\ cterm=NONE ctermfg=black ctermbg=red
\ gui=NONE guifg=black guibg=red
highlight CursorColumn cterm=NONE ctermfg=7 ctermbg=97 gui=NONE guifg=#c0c0c0 guibg=#875faf
highlight DiffAdd cterm=NONE ctermfg=8 ctermbg=24 gui=NONE guifg=#808080 guibg=#005f5f
highlight DiffChange cterm=NONE ctermfg=8 ctermbg=56 gui=NONE guifg=#808080 guibg=#5f00d7
highlight DiffDelete cterm=NONE ctermfg=8 ctermbg=88 gui=NONE guifg=#808080 guibg=#870000
highlight DiffText cterm=NONE ctermfg=8 ctermbg=90 gui=NONE guifg=#808080 guibg=#870087
" Status line.
highlight Error
\ cterm=NONE ctermfg=196 ctermbg=234
\ gui=NONE guifg=#ff0000 guibg=black
highlight ErrorMsg
\ cterm=NONE ctermfg=172 ctermbg=black
\ gui=NONE guifg=orange guibg=black
highlight Folded
\ cterm=NONE ctermfg=112 ctermbg=235
\ gui=NONE guifg=#87d700 guibg=#262626
highlight FoldColumn
\ cterm=NONE ctermfg=112 ctermbg=235
\ gui=NONE guifg=#87d700 guibg=#262626
" green Function names (has()).
highlight Function
\ cterm=NONE ctermfg=46 ctermbg=bg
\ gui=NONE guifg=#00ff00 guibg=bg
" lightyellow Names.
highlight Identifier
\ cterm=NONE ctermfg=139 ctermbg=bg
\ gui=NONE guifg=#af87af guibg=bg
highlight Include
\ cterm=NONE ctermfg=50 ctermbg=bg
\ gui=NONE guifg=#00ffd7 guibg=bg
highlight LineNr
\ cterm=underline ctermfg=244 ctermbg=237
\ gui=italic guifg=#808080 guibg=#3a3a3a
highlight Macro
\ cterm=NONE ctermfg=203 ctermbg=bg
\ gui=NONE guifg=#ff5f5f guibg=bg
" --More--
highlight MoreMsg
\ cterm=NONE ctermfg=123 ctermbg=238
\ gui=NONE guifg=#87ffff guibg=#444444
" --INSERT--
highlight ModeMsg
\ cterm=NONE ctermfg=123 ctermbg=238
\ gui=NONE guifg=#87ffff guibg=#444444
" Tilde and @ at the end of the window.
highlight NonText
\ cterm=bold ctermfg=cyan ctermbg=bg
\ gui=bold guifg=cyan guibg=bg
highlight Operator
\ cterm=NONE ctermfg=129 ctermbg=bg
\ gui=NONE guifg=#af00ff guibg=bg
highlight PmenuSbar cterm=NONE ctermfg=fg ctermbg=32 gui=NONE guifg=fg guibg=#0087d7
" medium blue #if/#else/#endif ${foo}
highlight PreProc
\ cterm=NONE ctermfg=75 ctermbg=bg
\ gui=NONE guifg=#5fafff guibg=bg
" Hit-enter and yes/no questions.
highlight Question
\ cterm=NONE ctermfg=green ctermbg=bg
\ gui=NONE guifg=green guibg=bg
highlight Search
\ cterm=NONE ctermfg=153 ctermbg=237
\ gui=NONE guifg=cyan guibg=gray10
" violett <F11>, printf %s, `cmd`
highlight Special
\ cterm=bold ctermfg=125 ctermbg=bg
\ gui=bold guifg=#af005f guibg=bg
" violett <F11> in map
highlight SpecialKey
\ cterm=NONE ctermfg=135 ctermbg=bg
\ gui=NONE guifg=#af5fff guibg=bg
highlight SpellBad
\ cterm=NONE ctermfg=88 ctermbg=140
\ gui=NONE guifg=#870000 guibg=#af87d7
highlight SpellCap
\ cterm=NONE ctermfg=88 ctermbg=138
\ gui=NONE guifg=#870000 guibg=#af8787
highlight SpellLocal
\ cterm=NONE ctermfg=118 ctermbg=236
\ gui=NONE guifg=#87ff00 guibg=#303030
highlight SpellRare
\ cterm=NONE ctermfg=19 ctermbg=75
\ gui=NONE guifg=#0000af guibg=#5fafff
" lightblue Keywords (highlight).
highlight Statement
\ cterm=NONE ctermfg=44 ctermbg=bg
\ gui=NONE guifg=#00d7d7 guibg=bg
highlight StatusLine
\ cterm=bold ctermfg=41 ctermbg=239
\ gui=bold guifg=#00d75f guibg=#4e4e4e
highlight StatusLineNC
\ cterm=NONE ctermfg=245 ctermbg=239
\ gui=NONE guifg=#8a8a8a guibg=#4e4e4e
" olive static, const, volatile
highlight StorageClass
\ cterm=NONE ctermfg=98 ctermbg=bg
\ gui=NONE guifg=#875fd7 guibg=bg
" green ''foo''
highlight String
\ cterm=NONE ctermfg=35 ctermbg=bg
\ gui=NONE guifg=#00af5f guibg=bg
" titles for output from ":set all", ":autocmd" etc.
highlight Title
\ cterm=NONE ctermfg=123 ctermbg=238
\ gui=NONE guifg=#87ffff guibg=#444444
" TODO XXX
highlight Todo
\ cterm=bold ctermfg=161 ctermbg=181
\ gui=bold guifg=#d7005f guibg=#d7afaf
" lightbeige int, long, ... ctermfg
highlight Type
\ cterm=NONE ctermfg=170 ctermbg=bg
\ gui=NONE guifg=#d75fd7 guibg=bg
" gray Visual selection
highlight Visual
\ cterm=NONE ctermfg=215 ctermbg=238
\ gui=NONE guifg=burlywood guibg=gray30
" gray Visual selection
highlight VisualNOS
\ ctermfg=215 ctermbg=238 ctermbg=bg
\ gui=NONE guifg=#5090c0 guibg=gray30
highlight WarningMsg
\ cterm=NONE ctermfg=green ctermbg=black
\ gui=NONE guifg=green guibg=black
highlight WildMenu
\ cterm=NONE ctermfg=23 ctermbg=148
\ gui=NONE guifg=#005f5f guibg=#afd700
if &term == "xterm-256color" && $DISPLAY == ""
" Cygwin mintty doesn't do italic.
highlight Comment cterm=NONE
highlight LineNr cterm=NONE
endif
用于选择 cterm 颜色编号的 6x6x6 colorcube: