Vim: "E185: Cannot find color scheme solarized"
Asked Answered
D

5

10

Setting up a new machine and trying to get Solarized running in Vim. Getting the following error when I run vim:

E185: Cannot find color scheme solarized

Tried to follow Pathogen install instructions from the Solarized README on the official repo. Checked this similar question & answer, which solved the problem by actually having the proper files in the directory, but as you can see below, my directory is indeed full of goodies (I just cloned it).

Details

  • iTerm2
  • .vimrc is loading, and other plugins are working
  • Tried to manually install Solarized also (by moving solarized.vim into .vim/colors), but got the same error

.vimrc

32 syntax enable  
33 " colo wombat  
34  
35 """ Solarized """  
36 let g:solarized_termcolors=256  
37 set background=dark  
38 colorscheme solarized  

.vim directory

├── autoload  
│   └── pathogen.vim  
├── bundle  
│   ├── ctrlp.vim  
│   │   ├── autoload  
│   │   │   ├── ctrlp  
│   │   │   │   ├── bookmarkdir.vim  
│   │   │   │   ├── buffertag.vim  
│   │   │   │   ├── changes.vim  
│   │   │   │   ├── dir.vim  
│   │   │   │   ├── line.vim  
│   │   │   │   ├── mixed.vim  
│   │   │   │   ├── mrufiles.vim  
│   │   │   │   ├── quickfix.vim  
│   │   │   │   ├── rtscript.vim  
│   │   │   │   ├── tag.vim  
│   │   │   │   ├── undo.vim  
│   │   │   │   └── utils.vim  
│   │   │   └── ctrlp.vim  
│   │   ├── doc  
│   │   │   ├── ctrlp.txt  
│   │   │   └── tags  
│   │   ├── plugin  
│   │   │   └── ctrlp.vim  
│   │   └── readme.md  
│   ├── supertab  
│   │   ├── Makefile  
│   │   ├── README.rst  
│   │   ├── doc  
│   │   │   ├── supertab.txt  
│   │   │   └── tags  
│   │   └── plugin  
│   │       └── supertab.vim  
│   ├── vim-colors-solarized  
│   │   ├── README.mkd  
│   │   ├── autoload  
│   │   │   └── togglebg.vim  
│   │   ├── bitmaps  
│   │   │   └── togglebg.png  
│   │   ├── colors  
│   │   │   └── solarized.vim  
│   │   └── doc  
│   │       ├── solarized.txt  
│   │       └── tags  
│   ├── vim-jade  
│   └── vim-surround  
│       ├── README.markdown  
│       ├── doc  
│       │   ├── surround.txt  
│       │   └── tags  
│       └── plugin  
│           └── surround.vim  
└── colors  
    └── wombat.vim  
Determinative answered 9/3, 2013 at 15:23 Comment(1)
Did you use a script to generate the file system map above?Thane
E
4

I ran into the same issue with Gnome Terminal (although gvim would work fine), and these were the lines I had to add to my .vimrc:

se t_Co=16
let g:solarized_termcolors=256  
set background=dark  
colorscheme solarized

Setting se t_co=256 without let g:solarized_termcolors=256, will also show colors, but not the right one as per the colorscheme, since it reverts to fallback mode with 256 colors.

This is similar to Mike's suggestion.

Epi answered 9/3, 2013 at 17:46 Comment(1)
the "let g:solarized_termcolors=256" seems to be the keyCalceolaria
T
4

Another solution after none of the above worked for me. This one's a real face-palmer.

Make sure that

""" Solarized """  
let g:solarized_termcolors=256  
set background=dark  
colorscheme solarized 

or whatever settings you use comes after your pathogen#infect() code.

Thane answered 1/4, 2016 at 13:49 Comment(0)
T
3
  • make sure syntax on is in your .vimrc
  • Check what t_Co vim is picked up from your term emulator (a quick :echo &t_Co). If it's 8 you'll want to se t_Co=16. You might also try se t_Co=256 though without let g:solarized_termcolors=16 this will use the 256 fallback mode, which isn't quite the correct color scheme.

my source

Turkey answered 9/3, 2013 at 17:19 Comment(2)
Does syntax enable (as in my file above), take care of turning syntax on, or do I need to use syntax on?Determinative
Indeed, &t_Co was set to 8.Determinative
T
2

Found this bug:

https://github.com/altercation/vim-colors-solarized/issues/104

cp ~/.vim/bundle/vim-colors-solarized/colors/solarized.vim ~/.vim/colors/
Terricolous answered 22/10, 2017 at 9:43 Comment(1)
It's not a bug though, it's the difference between manual installation (putting the solarized files under ~/.vim/colors/ or through a plugin manager. This "fix" just undoes the plugin's installation by copying the files to the manual location. The correct solution is the ony by @LeonardChallis.Kester
B
0

Leaving this here for others looking for possible solutions to similar E185 vim colorscheme errors: for me the jellybeans colorscheme was throwing the same error at startup, whether I had it in system wide /usr/share/vim/vimfiles/colors/jellybeans.vim or ~/.vim/colors/jellybeans.vim/jellybeans.vim.

I noticed that when I ran vim as sudo that my colors suddenly worked! That lead me to discover that the jellybeans.vim file needs write permissions on 'others' to work (not sure why, didn't look into the code for it). I did some testing, and at least for jellybeans on vim 7.4, vim will fail to find and load the colorscheme until the file permissions are: rw-rw-rw-

Beccafico answered 15/1, 2016 at 0:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.