Vim: “E185: Cannot find color scheme solarized”

笑着哭i 提交于 2019-12-23 07:40: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  

回答1:


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.




回答2:


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.




回答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




回答4:


Found this bug:

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

cp ~/.vim/bundle/vim-colors-solarized/colors/solarized.vim ~/.vim/colors/



回答5:


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-



来源:https://stackoverflow.com/questions/15312357/vim-e185-cannot-find-color-scheme-solarized

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!