为什么大多数 vim 配色方案在我使用它们时看起来不如屏幕截图? [英] Why don't most vim color schemes look as nice as the screenshot when I use them?
问题描述
我下载了很多 vim 颜色模式并试用了它们,但其中许多看起来不像官方截图.
I have downloaded many vim color schemas and tried them out, but many of them don't look like the official screenshot.
例如,vim 自己的颜色模式 - desert
应该是这样的:
For example, vim's own color schema - desert
should look like this:
但是在我的 vim 中,很多颜色都不会显示,例如背景.
But in my vim, many colors won't display, for example the background.
但有些颜色模式可以正常工作.
But some color schemas work correctly.
这是为什么?
在:编辑-> 配置文件首选项-> 颜色,我选择使用系统主题中的颜色"
In the: Edit-> Profile Preferences -> Colors, I select the "use colors from system theme"
推荐答案
许多配色方案设计为 256 色,明显优于标准的 8 色终端.要使其工作,您需要将 $TERM
设置为 256 色终端,例如 xterm-256color
.
Many colorschemes are designed for 256 colors, which is significantly better than a standard 8 color terminal. To make that work, you need $TERM
set to a 256 color terminal like xterm-256color
.
如果您有一个支持 256 色的终端(如果您是 Gnome 终端,则从屏幕截图看起来就像您所做的那样),将 $TERM
设置为 xterm-256color
并启用vimrc 中有 256 种颜色,例如:
If you have a 256 color capable terminal (looks like you do from your screenshot if that is Gnome Terminal), set the $TERM
to xterm-256color
and enable 256 colors in your vimrc with something like:
if $TERM == "xterm-256color"
set t_Co=256
endif
Vim wiki 有一些技巧,可以为不同的终端模拟器设置正确的 $TERM
.快速测试这个最简单的方法是做
The Vim wiki has some tips on setting the correct $TERM
for different terminal emulators. The easiest way to test this out quickly is to do
TERM=xterm-256color vim
这不会使为 GUI vim 设计的配色方案与终端 Vim 完全兼容,但会使 256 色配色方案工作,这是对标准 8 色配色方案的巨大改进.
This will not make colorschemes designed for GUI vim fully compatible with terminal Vim, but will make 256-color colorschemes work, and those are a giant improvement over the standard 8 color colorschemes.
这篇关于为什么大多数 vim 配色方案在我使用它们时看起来不如屏幕截图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!