本文介绍了为什么大多数vim配色方案看起来和我使用它们时的截图一样好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



例如,vim自己的颜色模式 - desert 应该如下所示:



但在我的vim中,不会显示许多颜色,例如背景。





在:
编辑 - >

颜色,我选择使用系统主题的颜色

解决方案

许多colorschemes设计用于256种颜色显着优于标准8色终端。要进行这项工作,需要将 $ TERM 设置为一个256色终端,如 xterm-256color



如果你有一个256色的终端(看起来像你从截图,如果是Gnome终端),设置 $ TERM xterm-256color ,并在vimrc中启用256种颜色,例如:

  if $ TERM ==xterm-256color
set t_Co = 256
endif

Vim wiki对设置正确的 $ TERM 用于不同的终端仿真器。最快的测试方式是做

  TERM = xterm-256color vim 

这不会使为color vim设计的colorschem与终端Vim完全兼容,但会使256色colorchems工作,这些都是一个巨大的改进超过标准的8色配色。


I have downloaded many vim color schemas and tried them out, but many of them don't look like the official screenshot.

For example, vim's own color schema - desert should look like this:

But in my vim, many colors won't display, for example the background.

But some color schemas work correctly.

Why is that?

In the:Edit-> Profile Preferences -> Colors, I select the "use colors from system theme"

解决方案

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.

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

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 

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配色方案看起来和我使用它们时的截图一样好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 11:53