altercation / vim-colors-solarized

precision colorscheme for the vim text editor
http://ethanschoonover.com/solarized
6.59k stars 1.76k forks source link

Solarized works after sourcing .vimrc from within vim, but not when starting vim. #190

Open GameKyuubi opened 7 years ago

GameKyuubi commented 7 years ago

This is kind of a bizarre problem. I installed solarized with VimPlug, added it to my .vimrc and sourced it, and the colors immediately worked. Closed vim, opened again, and I get the error E185: Cannot find color scheme 'solarized'. Huh. Yet sure enough, after pressing enter to get into vim and doing :source ~/.vimrc the solarized colors appear and work fine.

.vimrc:

syntax on                                                                                                                                                                                                                                                                                                                     
set tabstop=2                                                                                                                                                                                                                                                                                                                 
set shiftwidth=2                                                                                                                                                                                                                                                                                                              
set expandtab                                                                                                                                                                                                                                                                                                                 
set noshowmode                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
set number                                                                                                                                                                                                                                                                                                                    
set foldlevel=2                                                                                                                                                                                                                                                                                                               
set nofoldenable                                                                                                                                                                                                                                                                                                              
set foldmethod=indent                                                                                                                                                                                                                                                                                                         
set foldnestmax=10                                                                                                                                                                                                                                                                                                            
set laststatus=2                                                                                                                                                                                                                                                                                                              
set background=dark                                                                                                                                                                                                                                                                                                           
colorscheme solarized                                                                                                                                                                                                                                                                                                         

filetype plugin on                                                                                                                                                                                                                                                                                                            
set omnifunc=syntaxcomplete#Complete                                                                                                                                                                                                                                                                                          

" Specify a directory for plugins (for Neovim: ~/.local/share/nvim/plugged)                                                                                                                                                                                                                                                   
call plug#begin('~/.vim/plugged')                                                                                                                                                                                                                                                                                             
Plug 'altercation/vim-colors-solarized'                                                                                                                                                                                                                                                                                       
Plug 'tpope/vim-commentary'                                                                                                                                                                                                                                                                                                   
Plug 'majutsushi/tagbar'                                                                                                                                                                                                                                                                                                      
Plug 'scrooloose/nerdtree'                                                                                                                                                                                                                                                                                                    
Plug 'christoomey/vim-tmux-navigator'                                                                                                                                                                                                                                                                                         
Plug 'itchyny/lightline.vim'                                                                                                                                                                                                                                                                                                  
Plug 'ap/vim-buftabline'                                                                                                                                                                                                                                                                                                      
Plug 'junegunn/rainbow_parentheses.vim'                                                                                                                                                                                                                                                                                       
Plug 'airblade/vim-gitgutter'                                                                                                                                                                                                                                                                                                 
Plug 'mxw/vim-jsx'                                                                                                                                                                                                                                                                                                            
Plug 'pangloss/vim-javascript'                                                                                                                                                                                                                                                                                                
call plug#end()                                                                                                                                                                                                                                                                                                               

let g:jsx_ext_required = 0                                                                                                                                                                                                                                                                                                    

" \ev to edit .vimrc                                                                                                                                                                                                                                                                                                          
nnoremap <leader>ev :vsplit $MYVIMRC<cr>                                                                                                                                                                                                                                                                                      
" \sv to source .vimrc                                                                                                                                                                                                                                                                                                        
nnoremap <leader>sv :source $MYVIMRC<cr>                                                                                                                                                                                                                                                                                      

" Method navigation workaround for modern syntax                                                                                                                                                                                                                                                                              
map [[ ?{<CR>w99[{                                                                                                                                                                                                                                                                                                            
map ][ /}<CR>b99]}                                                                                                                                                                                                                                                                                                            
map ]] j0[[%/{<CR>                                                                                                                                                                                                                                                                                                            
map [] k$][%?}<CR>                                                                                                                                                                                                                                                                                                            

nnoremap <C-t> :TagbarToggle<CR>                                                                                                                                                                                                                                                                                              
nnoremap <C-n> :NERDTreeToggle<CR>                                                                                                                                                                                                                                                                                            

let g:lightline = {                                                                                                                                                                                                                                                                                                           
      \ 'colorscheme': 'solarized',                                                                                                                                                                                                                                                                                           
      \ }                          
hakilebara commented 7 years ago

There is a workaround in #104 : try moving colorscheme solarized after call plug#end()

DavidPesticcio commented 6 years ago

I had the same issue - then I found this :smiley: - https://stackoverflow.com/a/34165694/1506858

Your vimrc is supposed to be here: $HOME/.vimrc or there, if you use Vim 7.4 or newer: $HOME/.vim/vimrc