macos Mac OS X vim 颜色错位
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3642674/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Mac OS X vim colors mangled
提问by iljkj
Here's my setup
这是我的设置
- Mac OS X 10.6
- VIM (default version that comes with OSX 10.6)
- rails.vim (installed in .vim/autoload)
- ir_black.vim (installed in .vim/colors)
- i have "colorscheme ir_black" and "syn on" in ~/.vimrc
- Mac OS X 10.6
- VIM(OSX 10.6 附带的默认版本)
- rails.vim(安装在 .vim/autoload 中)
- ir_black.vim(安装在 .vim/colors 中)
- 我在 ~/.vimrc 中有“colorscheme ir_black”和“syn on”
Now when I go into terminal and edit a ruby file with vim my colors are messed up. There are only a few colors showing up and some text is even blinking. I'm wondering if there's a conflict between rails.vim syntax highlighting and the ir_black color scheme? Can anyone help me fix this? I would like to use the ir_black color scheme.
现在,当我进入终端并使用 vim 编辑一个 ruby 文件时,我的颜色被弄乱了。只有几种颜色显示出来,有些文字甚至在闪烁。我想知道 rails.vim 语法高亮和 ir_black 配色方案之间是否存在冲突?谁能帮我解决这个问题?我想使用 ir_black 配色方案。
回答by rossipedia
The Mac OSX Terminal.app in Snow Leoparddoes not support 256 colors, which is required for the ir_black theme (this is the theme I use).
Snow Leopard中的 Mac OSX Terminal.app不支持 256 色,这是 ir_black 主题所必需的(这是我使用的主题)。
Download and try something like iTerm.app (http://iterm.sourceforge.net/), and you shouldn't have a problem with colors.
下载并尝试像 iTerm.app ( http://iterm.sourceforge.net/)这样的东西,你应该不会有颜色问题。
Or you could use MacVim (http://code.google.com/p/macvim/)
或者你可以使用 MacVim ( http://code.google.com/p/macvim/)
Edit: As of OSX 10.7 Lion, the built in Terminal.app now supports 256 colors. See the comment below by Chris Pagefor how to achieve this.
编辑:从 OSX 10.7 Lion 开始,内置的 Terminal.app 现在支持 256 种颜色。有关如何实现这一目标,请参阅下面Chris Page的评论。
回答by Chris Page
As mentioned by others, ir_black requires 256 colors, which is not supported by Terminal on 10.6.x and earlier.
正如其他人提到的,ir_black 需要 256 种颜色,10.6.x 及更早版本的终端不支持。
As of Mac OS X Lion 10.7, Terminal now supports 256 colors and the default $TERM value is xterm-256colors. ir_black should work fine for you if you upgrade to Lion.
从 Mac OS X Lion 10.7 开始,终端现在支持 256 种颜色,默认的 $TERM 值为 xterm-256colors。如果您升级到 Lion,则 ir_black 应该可以正常工作。
回答by sprotsman
I've been using a nearly identical setup, except for vim, which I grab from Macports. A few years ago I found ir_black and loved it. I now use it for all vim sessions, Terminal.app, and TextMate. Getting it to work with Leopard, and then Snow Leopard was a tad hokey. But things have improved. Follow the instructions here, Making Terminal.app look great in Snow Leopard.
我一直在使用几乎相同的设置,除了 vim,这是我从 Macports 获取的。几年前,我发现了 ir_black 并爱上了它。我现在将它用于所有 vim 会话、Terminal.app 和 TextMate。让它与 Leopard 一起工作,然后是 Snow Leopard 有点傻。但情况有所好转。按照此处的说明使 Terminal.app 在 Snow Leopard 中看起来很棒。
回答by Paul
on testing which colors can be displayed in your terminal of choice: i just found this perl script on vim.org which dumps a list of 256 colors your terminal could possibly display... http://www.vim.org/scripts/script.php?script_id=1349
关于测试可以在您选择的终端中显示哪些颜色:我刚刚在 vim.org 上找到了这个 perl 脚本,它转储了您的终端可能显示的 256 种颜色的列表... http://www.vim.org/scripts/ script.php?script_id=1349
回答by Dominique
I use ir_black in Terminal.app but in 16 color mode, and it looks great. If you really prefer 256 color, I recommend iTerm2. The settings allow you to have the terminal report itself as "xterm-256" which is what's needed to use 256 colors in Vim.
我在 Terminal.app 中使用 ir_black 但在 16 色模式下,它看起来很棒。如果你真的更喜欢 256 色,我推荐 iTerm2。这些设置允许您将终端报告为“xterm-256”,这是在 Vim 中使用 256 色所需要的。
Check this website for the procedure: http://kevin.colyar.net/2011/01/pretty-vim-color-schemes-in-iterm2
检查这个网站的程序:http: //kevin.colyar.net/2011/01/pretty-vim-color-schemes-in-iterm2
There is a ir_black-based Vim theme called tir_black which is better suited for 256 colors: http://www.vim.org/scripts/script.php?script_id=2777
有一个基于 ir_black 的 Vim 主题叫做 tir_black,它更适合 256 色:http: //www.vim.org/scripts/script.php?script_id=2777
Looks awesome!
看起来很棒!
iTerm2 also has loads of nifty features.
iTerm2 还具有许多漂亮的功能。
I hope this helps.
我希望这有帮助。
回答by Jonah Braun
I have been using iTerm and was shocked to find out Terminal.app doesn't support 256 colors! I recommend Bryan's answer.
我一直在使用 iTerm 并惊讶地发现 Terminal.app 不支持 256 色!我推荐布莱恩的答案。
However, if you ever get in a bind like this, you can change $TERM to vt100 and vim won't try to use colors. In bash (the default MacOSX shell) you set this with:
但是,如果您遇到这样的绑定,您可以将 $TERM 更改为 vt100 并且 vim 不会尝试使用颜色。在 bash(默认的 MacOSX shell)中,您可以使用以下命令进行设置:
export TERM='vt100'
回答by srt32
I had the same issue with iTerm and solved it by going to Settings > Profile > Terminal > Report Terminal Typeand setting it to xterm-256color
.
我在 iTerm 上遇到了同样的问题,并通过转到“设置”>“配置文件”>“终端”>“报告终端类型”并将其设置为xterm-256color
.