clee101
clee101

Reputation: 131

Trouble Getting Colorschemes in Vim with Iterm2

I can't get the vimbrant colorscheme (or any) to work in Vim with Iterm2. This is my .vimrc file:

syntax on
syntax enable
colorscheme vimbrant
set background=dark

I have Iterm set up to use xterm-256 like it says in the FAQ as well. Whenever I echo in Vim it says 256.

The terminal also doesn't use the color settings I have in Iterm2 but I don't care about that as much.

EDIT: The file is in ~/.vim/colors/vimbrant.vim. Also, I forgot to mention that my cursor seems to have the right colors for variables and structs and whatnot, but the text itself is all white still. The background seems to be the correct color. And the only thing in my .gvimrc file is colorscheme vimbrant.

Upvotes: 8

Views: 15885

Answers (5)

Cory Klein
Cory Klein

Reputation: 55680

After trying all other suggestions made here and elsewhere, the final thing that worked for me was:

set termguicolors

Upvotes: 0

sbaxter
sbaxter

Reputation: 806

I have my iterm2 colors highly customized, and build a specific theme for vim/janus. My iterm2 colors are fine, but after the 20161204 nightly build, colors would be all messed up in vim.

I noticed the colors that were off in vim were my iterm2 profile "bright" colors. I tried set background=dark in my .vimrc, but that didn't fix it. However using set background=light, my colors are exactly how I used to have them again!

I clearly did something backwards when configuring vim, but I've fine tuned it the way I like it. I hope this helps for anyone else having an issue with vim colors after December 4th 2016.

Upvotes: 1

clee101
clee101

Reputation: 131

Really dumb mistake, I had minimum contrast maxed out without realizing.

Upvotes: 5

romainl
romainl

Reputation: 196546

syntax enable is useless after syntax on.

set background=dark is also generally useless outside of a colorscheme.

Does your colorscheme work when you do :colorscheme vimbrant? Where did you install it?

Upvotes: 0

Leo Gasparrini
Leo Gasparrini

Reputation: 171

I've been having the same issue and this is what seems to have solved it:

In your .bash_profile set CLICOLOR before setting TERM:

# Set CLICOLOR if you want Ansi Colors in iTerm2 
export CLICOLOR=1

# Set colors to match iTerm2 Terminal Colors
export TERM=xterm-256color

save bash file and source:

source ~/.bash_profile 

Then, in your iTerm2 Preferences > Terminal > Report Terminal Type, set to either xterm-256color or xterm

Close iTerm2, restart it and type ls. That did the trick for me.

Good luck.

Upvotes: 4

Related Questions