Custom colorscheme not working on VIM
Asked Answered
N

3

19

Here's what I did:

cp ~/.vim/colors/ir_black.vim /usr/share/vim/vim72/colors/

Then tried to open some code and :colorscheme ir_black

It changes a few colors but makes most of the text start to blink with the cursor. It happens with almost all the other custom colorschemes as well. Does anyone have any ideas of what might be wrong?

I added t_Co=256 to my .vimrc file and it didn't seem to help.

PS: I'm on a Mac OS X.

Noonan answered 13/1, 2011 at 23:58 Comment(2)
I don't think this is answerable without knowing what's in ir_black.vim.Noontime
The terminal on osx doesn't support 256 colors. Also, you should probably never change t_Co manually, it is derived from the capabilities your terminal reports.Orangutan
I
17

Edit : I found an exact duplicate of your question :here. It seems to be an issue with iTerm not supporting 256 colors by default.

The usual problem with color scheme and terminal is that terminal are often limited to 256 colors, and GUI color scheme are using 2^32 colors. So some of them are not correctly rendered in terminal.

There is a simple test to check: if you are lauching the GUI version is the color scheme rendered correctly ?

The possible solution are :
1. Convert your color scheme to 256 colors using the following plugin : CSApprox.vim
2. Choose a different color scheme. (Often on Vim.org color schemes compatible with Terminal have "256" in their name, like "wombat256" for example)
3. Use a GUI version like MacVim or GVim

If I remember correctly, the color sheme Zenburn is working nicely with both GUI and terminal version. It is rather dark with pastel colors.

Personal story : after spending ages to fiddle with color scheme to get something right for terminal, I switched to the GUI version. The GUI version with the icon bar hidden is not really different to terminal version anyway, as long as you are working locally

Inweave answered 14/1, 2011 at 8:3 Comment(3)
Sorry for taking so long and thank you! I just switched to MacVim for working locally and configured my own colorscheme to make it work on terminal. :)Noonan
Just a comment: I installed CSApprox.vim and every color scheme I try now is working well. Thanks for the tip!Orms
+1 It is the answer which solved my problem (i.e. using colorscheme wombat (or rather - colorscheme wombat256mod) in terminal). Before I was lured into installing GUI interfaces, checking iTerm2 options, etc...Tambac
L
35

Set your TERM to xterm-256color. Follow up on the iterm2 mailing list if that still doesn't work.

Lots answered 26/1, 2011 at 0:30 Comment(2)
This is the solution. Awesome. Thanks. Quick note of clarity though for others, to do this, open to your .vimrc file and add "set term=xterm-256color" anywhere before setting the color scheme.Treiber
This is the solution.Sarcenet
I
17

Edit : I found an exact duplicate of your question :here. It seems to be an issue with iTerm not supporting 256 colors by default.

The usual problem with color scheme and terminal is that terminal are often limited to 256 colors, and GUI color scheme are using 2^32 colors. So some of them are not correctly rendered in terminal.

There is a simple test to check: if you are lauching the GUI version is the color scheme rendered correctly ?

The possible solution are :
1. Convert your color scheme to 256 colors using the following plugin : CSApprox.vim
2. Choose a different color scheme. (Often on Vim.org color schemes compatible with Terminal have "256" in their name, like "wombat256" for example)
3. Use a GUI version like MacVim or GVim

If I remember correctly, the color sheme Zenburn is working nicely with both GUI and terminal version. It is rather dark with pastel colors.

Personal story : after spending ages to fiddle with color scheme to get something right for terminal, I switched to the GUI version. The GUI version with the icon bar hidden is not really different to terminal version anyway, as long as you are working locally

Inweave answered 14/1, 2011 at 8:3 Comment(3)
Sorry for taking so long and thank you! I just switched to MacVim for working locally and configured my own colorscheme to make it work on terminal. :)Noonan
Just a comment: I installed CSApprox.vim and every color scheme I try now is working well. Thanks for the tip!Orms
+1 It is the answer which solved my problem (i.e. using colorscheme wombat (or rather - colorscheme wombat256mod) in terminal). Before I was lured into installing GUI interfaces, checking iTerm2 options, etc...Tambac
O
2

the default vim binary in /usr/bin/ will not work with any terminal. you need to have a version that supports gui - type "echo has('gui')" in vim command mode to check.

so your only option is to use a gui one (macvim etc.), or compile it with athena, gtk or x11 with macports, but i would advise against the latter, because it pulls down a shitload of dependencies.

i think it's better to use macvim for serious development that needs syntax highlighting, and use the 16 colour version in the terminal for quick edits.

Octroi answered 9/6, 2011 at 12:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.