使用 Solarized 在 iTerm2 中使用 vim 的颜色不正确 [英] Incorrect colors with vim in iTerm2 using Solarized

查看:28
本文介绍了使用 Solarized 在 iTerm2 中使用 vim 的颜色不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在终端 vim(非 gui)和日光化配色方案中遇到了 iTerm2 一个奇怪的问题.首先,我已将 iTerm2 设置为使用深色日晒配色方案.

I am having a strange issue with iTerm2, in terminal vim (non-gui) and the solarized color scheme. First, I have set iTerm2 to use the dark solarized colour scheme.

我也在 vim 中使用了solarized.我的 .vimrc 中有以下几行

I am also using solarized for vim. I have the following lines in my .vimrc

set background=dark
colorscheme solarized

在终端中,配色方案看起来不正确:

In the terminal the color scheme looks incorrect:

参考这是它在 MacVim (gui vim) 下的样子

For reference this is how it looks under MacVim (gui vim)

我需要在 iTerm 或我的 .vimrc 中更改什么才能使颜色在控制台 vim 中正确显示?

What do I need to change in iTerm or my .vimrc to get the colors looking correctly in my console vim?

推荐答案

需要检查的几件事:

  1. 在 iTerm2 中,在首选项 -> 配置文件 -> 终端中,在终端仿真"下,您将报告终端类型:"设置为 xterm-256color.

  1. In iTerm2, in Preferences -> Profiles -> Terminal, under "Terminal Emulation" you have "Report Terminal Type:" set to xterm-256color.

在您的 .vimrc 中,您还可以设置一些选项以确保它使用 256 种颜色:

In your .vimrc, there are some options you can also set to make sure it's using 256 colors:

set background=dark
" solarized options 
let g:solarized_visibility = "high"
let g:solarized_contrast = "high"
colorscheme solarized

其中一个应该可以工作,但首先要#1.

And one of those should work, but #1 first.

但是,如果您在 Snow Leopard 上使用默认的内置 vim,它将无法工作,因为它不支持 256 种颜色.我相信 Lion 的内置版本确实如此.

BUT, if you're using the default, built in vim on Snow Leopard, it won't work, as it's not built with support for 256 colors. I believe the built in version in Lion does.

根据对此答案的几条评论,我从 .vimrc 示例中删除了 let g:solarized_termcolors = 256 行多于.对某些人来说,这似乎是个问题.另一个说添加行 let g:solarized_termcolors = 16 修复了颜色显示问题.您自己的里程可能会有所不同.

Based on several comments on this answer, I've removed let g:solarized_termcolors = 256 line from the .vimrc example above. It appears that could be a problem for some. Another says that adding the line let g:solarized_termcolors = 16 fixed a color display problem. Your own mileage may vary.

第二次如果您已将日晒调色板加载到 iTerm2 中,那么您必须let g:solarized_termcolors=16.只有让 g:solarized_termcolors=256 如果您使用日晒调色板作为您的 iTerm2 颜色预设.

Second If you've loaded the solarized color palette into iTerm2, then you must let g:solarized_termcolors=16. Only let g:solarized_termcolors=256 if you are not using the solarized palette as your iTerm2 color preset.

这篇关于使用 Solarized 在 iTerm2 中使用 vim 的颜色不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆