代码之家  ›  专栏  ›  技术社区  ›  unholysampler

在vim中更改语法颜色?

  •  41
  • unholysampler  · 技术社区  · 15 年前

    我打开了语法突出显示,但注释设置为深蓝色。我很难在黑色终端上看书。我该如何更改它,以便将注释改为绿色?

    5 回复  |  直到 8 年前
        1
  •  71
  •   sth    13 年前

    也许你只需要告诉Vim你有一个黑暗的背景:

    :set background=dark
    

    这应该将突出显示改为可读性更好的内容。

        2
  •  10
  •   Brian Agnew    15 年前

    看一看 syncolor.vim . 你可以在里面找到它 /usr/share/vim/vim{version}/syntax/ .

    Excerpt:

    " There are two sets of defaults: for a dark and a light background.
    if &background == "dark"
      SynColor Comment  term=bold cterm=NONE ctermfg=Cyan ctermbg=NONE gui=NONE guifg=#80a0ff guibg=NONE
      SynColor Constant term=underline cterm=NONE ctermfg=Magenta ctermbg=NONE gui=NONE guifg=#ffa0a0 guibg=NONE
      SynColor Special  term=bold cterm=NONE ctermfg=LightRed ctermbg=NONE gui=NONE guifg=Orange guibg=NONE
    

    所以第一个 SynColor 线条感兴趣。我承认我不知道你是否可以覆盖这个,而不是更改这个文件。

        3
  •  7
  •   kejadlen    15 年前

    如果要在不更改背景的情况下更改注释的颜色,可以使用 highlight 命令。 Vim documentation on :highlight

    例如, :hi Comment term=bold ctermfg=Cyan guifg=#80a0ff gui=bold

        4
  •  1
  •   Motte001    8 年前

    你可以设定 colorsheme desert . 如Ubuntu 16.04中的默认值

        5
  •  0
  •   Jonathan Feinberg    15 年前

    $VIMRUNTIME/colors/README.txt (在我的系统上,/usr/share/vim/vim72/colors)