Mac OS X vim colors mangled
Asked Answered
C

7

13

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

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.

Conversation answered 4/9, 2010 at 14:26 Comment(1)
The general solution to something like this in linux is to install the appropriate terminal specifications (generally in a package like ncurses-term). It can also happen if your colorscheme is (carelessly) trying to use 256 colors when the terminal doesn't support it, I believe.Nalepka
P
18

The Mac OSX Terminal.app in Snow Leopard does not support 256 colors, which is required for the ir_black theme (this is the theme I use).

Download and try something like iTerm.app (http://iterm.sourceforge.net/), and you shouldn't have a problem with colors.

Or you could use 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 Page for how to achieve this.

Primer answered 4/9, 2010 at 19:6 Comment(4)
Thank you for the answer. Is there a terminal command to see how many colors the current terminal supports? I googled but can't find anything.Conversation
I can't find one either. I did find infocmp, however, that reports 256 colors in Terminal.app, which is incorrect.Primer
As of Mac OS X Lion 10.7, Terminal now supports 256 colors. The most direct way to see the number of colors supported by the current terminfo ($TERM) is tput colors. @Bryan Ross, either you're using Lion or a custom terminfo is selected. Check Terminal > Preferences > Settings > [profile] > Advanced > Declare terminal as. This sets the value of $TERM (in fact, that's all it does). Prior to Lion the default value is xterm-color, which declares 8 colors as shown by TERM=xterm-color tput colors, although most programs seem to assume 16 are supported if 8 are.Kimberly
I have the same issue with the Mac terminal on El Capitan. Even though it's configured to xterm-256color. I've also tried using that Base16-Shell fixer but that made no difference for meManslayer
G
3

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.

Gerund answered 18/1, 2011 at 6:49 Comment(1)
As of Mac OS X Lion 10.7, Terminal now supports 256 colors. So using SIMBL is no longer necessary.Kimberly
K
3

As mentioned by others, ir_black requires 256 colors, which is not supported by Terminal on 10.6.x and earlier.

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.

Kimberly answered 26/8, 2011 at 0:55 Comment(1)
As of Mac OS X Lion 10.7, Terminal now supports 256 colors.Kimberly
R
1

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

Retrieve answered 23/2, 2011 at 11:11 Comment(0)
L
0

I have been using iTerm and was shocked to find out Terminal.app doesn't support 256 colors! I recommend Bryan's answer.

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:

export TERM='vt100'
Lisp answered 12/11, 2010 at 3:53 Comment(1)
As of Mac OS X Lion 10.7, Terminal now supports 256 colors.Kimberly
P
0

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.

Check this website for the procedure: 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

Looks awesome!

iTerm2 also has loads of nifty features.

I hope this helps.

Printing answered 26/8, 2011 at 0:6 Comment(3)
As of Mac OS X Lion 10.7, Terminal now supports 256 colors.Kimberly
Thanks Chris. Indeed my comment applies to Snow Leopard. Anyhow I hope some find it useful.Printing
Yes, I understand. I was just trying to provide an update, since the answer is now different on Lion.Kimberly
C
0

I had the same issue with iTerm and solved it by going to Settings > Profile > Terminal > Report Terminal Type and setting it to xterm-256color.

Cultigen answered 7/4, 2014 at 2:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.