E185: Cannot find color scheme solarized

2019-01-17 14:15发布

问题:

I have Solarized installed via pathogen and it's been working fine in both terminal and MacVim on my Mac. Today, I tried setting up an Ubuntu box on Linode. I just cloned my dotfiles and symlinked to my .vim and .vimrc folders (this is the same setup as I use on my local machine.

Whenever I try to run vim on the Ubuntu box I get an error

Error detected while processing /root/.vimrc:
line   43:
E185: Cannot find color scheme solarized
Press ENTER or type command to continue

I can tell my .vimrc is being loaded because all other setting like line numbers are working.

The related lines in .vimrc are the following:

" settings needed for solarized colorscheme
syntax enable
set background=dark
let g:solarized_termcolors=256
colorscheme solarized

This is the setup of my .vim/bundle directory (incase you suspect I don't actually have solzrized in there!):

~  ls .vim/bundle 
ack                  coffeescript         liquid               snipmate             vim-colors-solarized vim-jst              zencoding
closetag             html5.vim            nerdtree             surround             vim-javascript       vim-rails

One other thing, running echo &t_Co in vim on the ubunto box gets me 256.

Any ideas?

回答1:

I know that it is kind of obvious, but did you check the contents of ~/.vim/bundle/vim-colors-solarized? Just in case you are running in the same issue described in Vim: Pathogen not loading



回答2:

I was running into this problem just now, too. I had my call pathogen#infect() line in my .vimrc just fine, but was getting the

E185: Cannot find color scheme solarized

error, like you. I moved my call pathogen#infect() up to the top of my .vimrc and all is swell now. Try that if you're still having problems!



回答3:

:colo[rscheme] {name}   Load color scheme {name}.  This searches 'runtimepath'
            for the file "colors/{name}.vim.  The first one that
            is found is loaded.

You should put solarized.vim in ~/.vim/colors/.



回答4:

This is what I did;

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


回答5:

One step you might be missing is to add

call pathogen#infect()

to your .vimrc file.

Src: http://www.vim.org/scripts/script.php?script_id=2332



回答6:

I just ran into this problem myself on a new CentOS box where 'vi' was mapped to a version of VIM without syntax support (ie. -syntax) and was giving the E185: Cannot find color scheme solarized error, while 'vim' mapped to a version with syntax support and worked fine with solarized.

Aliasing 'vi' to 'vim' resolved the issue.


For reference:

To check if the version of vim that you are running has support for syntax highlighting, run :version from within vim. -syntax means no support, +syntax means it has support.

To create the alias, append alias vi='vim' to your ~/.bashrc or ~/.bash_profile

To re-source, type source ~/.bashrc or source ~/.bash_profile, whichever is appropriate for your setup.



回答7:

I was getting this problem and I fixed it by issuing

cd ~/.yadr
git pull
rake update


回答8:

I fix it ;)

Found this bug:

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

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