morhetz / gruvbox

Retro groove color scheme for Vim
13.59k stars 1.1k forks source link

Error while adding colorscheme to lightline #356

Open danedavid opened 3 years ago

danedavid commented 3 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 1 year 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'}.