0

I use iTerm2 (Build 1.0.0.20130319) and Vim (bin of MacVim Snapshot 66) on top of OS X 10.7.5 as my CLI editing team.

iTerm2:

  • Color scheme: Solarized Dark
  • Terminal type: xterm
  • Minimum contrast: lowest
  • Transparency: none
  • Dimming: disabled
  • Background image: none

Vim:

set t_Co=16
set background=dark
colorscheme solarized

echo &t_Co returns 16. Generally I do not seem to have issues with a basic setup. But additionally I try to give "NonText" and "SpecialKey" characters a color value avaiable from the solarized color palette (palette can be found here).

highlight NonText ctermfg=0
highlight NonText guifg=#073642

highlight SpecialKey ctermfg=0
highlight SpecialKey guifg=#073642

The strange thing is while the "SpecialKey" group displays the "cterm" color value correctly, the "nonText" group does not. It seems that it displays the value 8 which is used by "ctermbg". As a consequence all "NonText" characters are not visible anymore. Both groups accept the "guifg" values btw.

Am I missing something which could interfere with my setup?

Saucier
  • 4,200
  • 1
  • 25
  • 46
  • Interesting, when I set `set t_Co=8`then "NonText" chars accept the given value. But then other problems arise. So not really a solution. – Saucier Mar 21 '13 at 14:04
  • 1. The number of colors that corresponds to `xterm` is 8, not 16. 2. Vim knows how to get the correct number of colors for the `$TERM` it picked up when it started. If iTerm is set to `xterm`, Vim correctly infers "8 colors" and you have absolutely no need to do anything in Vim. 3. Actually, setting term-related options to non-standard values or forcing them to values not supported by your terminal is quite a bad idea. – romainl Mar 21 '13 at 14:12
  • What "other problems"? – romainl Mar 21 '13 at 14:20
  • @romainl, understood your points. An alternative is to tell iTerm2 to emulate xterm-256, which results in the same problem as above. When using 8 colors only, the colors of the powerline plugin are not displayed correctly. – Saucier Mar 21 '13 at 14:34
  • 1
    Frankly, the problem is solarized. Do you see all the solarized questions on the right? That thing is a mess. And Powerline is not better. There's no point using anything other than `xterm-256color` in this day and age. What is the problem with `xterm-256color`? That your `NonText` doesn't work? – romainl Mar 21 '13 at 14:54
  • Exactly, the color value for `NonText` does not seem to be the right tone. – Saucier Mar 21 '13 at 15:23
  • Which one do you expect? According to [that table](https://github.com/altercation/solarized/tree/master/iterm2-colors-solarized), `0` is supposed to mean "black" when `t_Co == 16` and nothing when `t_Co == 8` while it seems that you must use `4` in that case. But the base color it refers to is `#073642`, a medium blue. What a mess. – romainl Mar 21 '13 at 15:55
  • As a reminder: The color gets displayed correctly in the `SpecialKeys`group, no matter if I use 8, 16 or 256 colors. That's why I'm wondering why the same color does not apply to the `NonText` group. But yes you are right 0 is "black" (base02) according to the color palette and that's what I expect it to be. – Saucier Mar 21 '13 at 16:21
  • Do you do all that in solarized colorscheme or in your vimrc? – romainl Mar 21 '13 at 16:57
  • I'm not quite sure what you mean. But I simply use the "prebuilt" themes for iTerm2 and Vim and try to assign values from the solarized color palette to groups inside .vimrc. – Saucier Mar 22 '13 at 00:27
  • You are using the solarized colorscheme in Vim, right? If you want to tweak its colors you must do that in the colorscheme itself, not in your `~/.vimrc`. – romainl Mar 22 '13 at 05:47

1 Answers1

2

I found a solution on the solarized bugtracker.

This config lets one assign colors to certain elements and groups:

highlight CursorLineNr cterm=none ctermfg=0 guifg=#073642
highlight NonText cterm=none ctermfg=0 guifg=#073642
highlight SpecialKey cterm=none ctermfg=0 guifg=#073642 ctermbg=8 guibg=#002b36

Notice the

cterm=none

which fixes the problem.

Saucier
  • 4,200
  • 1
  • 25
  • 46