8

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.

clee101
  • 131
  • 1
  • 1
  • 6
  • this isn't relevant to the OP, but because the post started with `syntax on`, i didn't even try it. i kept typing `:set syntax=php` and vim would act like it did it...i just had never encountered a vim configuration where syntax was off, i guess. moral: be sure to try `:syntax on` or put `syntax on` in your vimrc. _(note to self: ponder why macos would default to syntax off)_ – WEBjuju Feb 05 '20 at 14:48

5 Answers5

5

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

clee101
  • 131
  • 1
  • 1
  • 6
  • 1
    Really, really, really need to emphasize this answer if you're like me. I setup iTerm2 for the first time, knew I wanted dark solarized as my color settings, but I didn't like the grey text. Saw the slider changed it to white and totally overlooked the functionality. Google, SEO to this! :) – rchav9 Jul 06 '17 at 20:46
4

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.

Leo Gasparrini
  • 160
  • 1
  • 12
  • oh man :( I'm sorry! Did 'u try to install `macvim`? you should see [this](http://stackoverflow.com/questions/3761770/iterm-vim-colorscheme-not-working) – Leo Gasparrini Jan 24 '15 at 05:32
  • do you have Terminal or ITerm2? do you try to restart it? – Leo Gasparrini Mar 18 '17 at 15:51
  • 1
    This does not work for me, either. Using MacVim I can change background just fine, but after exporting these shell vars and completely restarting iTerm does not change anything. If not for this one issue, I would completely uninstall MacVim, as I'm finally in a setup where all my plugins work in term as well as in MacVim/GVim. – thynctank Aug 12 '19 at 14:14
1

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.

shin
  • 31,901
  • 69
  • 184
  • 271
sbaxter
  • 806
  • 7
  • 5
0

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?

romainl
  • 186,200
  • 21
  • 280
  • 313
  • No, doing that command in Vim does nothing. 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. – clee101 Jan 24 '15 at 00:48
  • It should be ~/.vimrc, not ~/.gvimrc. – romainl Jan 24 '15 at 07:19
0

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

set termguicolors
Cory Klein
  • 51,188
  • 43
  • 183
  • 243