morhetz / gruvbox

Retro groove color scheme for Vim
13.86k stars 1.11k forks source link

Error while adding colorscheme to lightline #356

Open danedavid opened 4 years ago

danedavid commented 4 years ago

Installed gruvbox using Pathogen, by cloning to ~/.vim/bundle. Theme is working fine. But as soon as I add 'colorscheme': 'gruvbox' to lightline config, the following error pops up:

"." is a directory
Error detected while processing BufEnter Autocommands for "*"..function nerdtree#checkForBrowse[9]..185[2]..186[19]..197[28]..FileType Autocommands for "*"..function lightline#up
date[3]..lightline#colorscheme[21]..BufEnter Autocommands for "*"..function nerdtree#checkForBrowse[9]..185[2]..186[19]..197[28]..FileType Autocommands for "*"..function lightlin
e#update[3]..lightline#colorscheme[18]..lightline#highlight:
line   18:
E254: Cannot allocate color guibg=
E421: Color name or number not recognized: ctermfg= ctermbg= term=bold cterm=bold gui=bold
Error detected while processing BufEnter Autocommands for "*"..function nerdtree#checkForBrowse[9]..185[2]..186[19]..197[28]..FileType Autocommands for "*"..function lightline#up
date:
line    3:
E171: Missing :endif
Press ENTER or type command to continue

System details: macOS v10.15.6 iTerm2 v3.3 Vim v8.2

I added the followig 2 lines to .vimrc & also installed gruvbox iTerm colors:

autocmd vimenter * colorscheme gruvbox
let g:gruvbox_termcolors=16
jorge-castro commented 2 years ago

While the wiki suggests using the autocmd to set the colorscheme because it allows the rest of the plugins to load first it seems to be the cause of this issue. I was able to fix it by replacing it with a simple set colorscheme gruvbox and adding it to lighline as normal, i.e. let g:lightline = {'colorscheme': 'gruvbox'}.