Vim使用zsh和Terminator无法正确显示配色方案



正如标题所说,Vim没有正确显示配色方案。在某些配色方案中,背景颜色会发生变化,但文本颜色始终保持为白色/灰色。正如标题所说,我正在运行zsh和Terminator以及Manjaro Linux,如果这对它有任何影响的话

其他帖子建议我把[[ "$TERM" == "xterm" ]] && export TERM=xterm-256color放在我的~/.zshrc文件中,把set t_Co=256放在~/.vimrc文件中,但这对我不起作用。还有什么可能导致vim这样做?

编辑:~/.virc

set nocompatible              " be iMproved, required
filetype off                  " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'morhetz/gruvbox'
" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"
set t_Co=256

要确保您的xterm编译时支持256色,请尝试运行此颜色测试shell脚本。

#!/bin/sh
#
# colortest256.sh - output a color test page
clear=$(printf "33[m")
bg=$(printf "33[48;5;")
fg=$(printf "33[38;5;")
bd=$(printf "33[1m")
printf "The 16 ${bd}system colors:$clearn"
for color in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
  printf "$bg${color}m$fg%dm%3d" $((color % 4 ? 0 : 15)) $color
  test $color = 7 && printf "$clear${fg}0mn"
done
printf "$clearnn"
printf "The 6x6x6 color cube:n"
for g in 0 1 2 3 4 5; do
  for r in 0 1 2; do
    for b in 0 1 2 3 4 5; do
      : $((color = 16 + r * 36 + g * 6 + b))
      printf "$bg${color}m$fg%dm%3d$clear" $((g > 2 ? 0 : 15)) $color
      test $b -lt 5 && printf ' '
    done
    printf "$clear"
    test $r -lt 2 && printf '|'
  done
  printf "n"
done
printf '%sn' "-----------------------+-----------------------+-----------------------"
for g in 0 1 2 3 4 5; do
  for r in 3 4 5; do
    for b in 0 1 2 3 4 5; do
      : $((color = 16 + r * 36 + g * 6 + b))
      printf "$bg${color}m$fg%dm%3d$clear" $((g > 2 ? 0 : 15)) $color
      test $b -lt 5 && printf ' '
    done
    test $r -lt 5 && printf '|'
    printf "$clear"
  done
  printf "n"
done
printf "n"
printf "The neutral step wedge:n";
for color in 232 233 234 235 236 237 238 239 240 241 242 243; do
  printf "$bg${color}m${fg}15m%4d" $color
done
printf "$clearn"
for color in 244 245 246 247 248 249 250 251 252 253 254 255; do
  printf "$bg${color}m${fg}0m%4d" $color
done
printf "$clearn"

如果这能正常工作,我们会看看你的vim配置。

这是我的~/.vimrc中的颜色配置;也许它可以让你开始。

" The cterm color numbers refer to XTerm colors in 256 color mode.
" Map from cterm colors to #RGB using <URL:https://gist.github.com/719710>.
" To turn off bold, italic, use cterm=NONE and gui=NONE.
"
" 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=NONE      ctermfg=250     ctermbg=bg
 gui=italic      guifg=#bcbcbc   guibg=bg
highlight ColorColumn
 cterm=NONE      ctermfg=fg      ctermbg=234
 gui=NONE        guifg=fg        guibg=#1c1c1c
" blue        if/then/else/fi.
highlight Conditional
 cterm=NONE      ctermfg=27      ctermbg=bg
 gui=NONE        guifg=#005fff   guibg=bg
" light green 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
highlight Directory
 cterm=NONE      ctermfg=75      ctermbg=bg
 gui=NONE        guifg=#5fafff   guibg=bg
" 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
" light yellow 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=italic    ctermfg=244     ctermbg=237
 gui=italic      guifg=#808080   guibg=#3a3a3a
highlight Macro
 cterm=NONE      ctermfg=150     ctermbg=bg
 gui=NONE        guifg=#afd787   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
" Completion Popup menu
highlight PmenuSbar
 cterm=NONE      ctermfg=fg      ctermbg=216
 gui=NONE        guifg=fg        guibg=#ffaf87
highlight PmenuThumb
 cterm=NONE      ctermfg=fg      ctermbg=127
 gui=NONE        guifg=fg        guibg=#af00af
highlight Pmenu
 cterm=NONE      ctermfg=241     ctermbg=223
 gui=NONE        guifg=fg        guibg=#ffd7af
highlight PmenuSel
 cterm=NONE      ctermfg=55      ctermbg=133
 gui=NONE        guifg=fg        guibg=#af5f5f
" 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
" violet      <F11>, printf %s, `cmd`
highlight Special
 cterm=bold      ctermfg=125     ctermbg=bg
 gui=bold        guifg=#af005f   guibg=bg
" violet      <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
" light blue  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
" light pink 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

相关内容

  • 没有找到相关文章

最新更新