junegunn / rainbow_parentheses.vim

:rainbow: Simpler Rainbow Parentheses
377 stars 24 forks source link

Error when opening Vim with no file #3

Closed cparadis6191 closed 9 years ago

cparadis6191 commented 9 years ago

I just switched from kien's plugin and ran into a problem. When opening Vim without a file (i.e. empty buffer) the following error occurs.

Error detected while processing function rainbow_parentheses#activate..<SNR>55_extract_colors..<SNR>55_blacklist:
line    2:
E411: highlight group not found: Normal
Press ENTER or type command to continue

I can replicate the problem with a very minimal vimrc (just vim-plug and the following).

" Rainbow Parentheses
let g:rainbow#max_level=16
let g:rainbow#pairs=[ ['(', ')'], ['[', ']'], ['{', '}'] ]
autocmd VimEnter * RainbowParentheses

The offending line:

https://github.com/junegunn/rainbow_parentheses.vim/blob/master/autoload/rainbow_parentheses.vim#L97

Changing the silent call to silent! seems to fix the problem (or hides it) but I'm no vimscript expert and I don't know if that could possibly break other things.

Thanks for any help.

junegunn commented 9 years ago

Hi, thanks for the report. It looks your color scheme does not define Normal highlight group unlike most other colorschemes and silent! is a simple and valid fix to the problem. Thanks.

cparadis6191 commented 9 years ago

Ahh, thanks. I think the problem is that I don't have a colorscheme in Vim at all. I just use the default. It works now.