7

I have tried to put the following in my .vimrc file:

syn match parens /[(){}]/
hi parens ctermfg=red

to permanently color brackets, parentheses, braces etc, however it doesnt work. If I do it inline inside vim it does work.

Any ideas why?

Thanks

2 Answers 2

4

Because all syntax highlighting is local to the buffer that is active when the syntax items are defined. Try something like this:

autocmd BufRead,BufNewFile * syn match parens /[(){}]/ | hi parens ctermfg=red
2
  • Perfect answer. In my copy I replaced BufRead,BufNewFile with VimEnter and put the hi line in my colors file. Beeyouteefull.
    – lee8oi
    Dec 15, 2018 at 21:15
  • Maybe I should say, VimEnter,BufWinEnter. That's what finally got it working for me both when I opened vim and when using :e filename.
    – lee8oi
    Dec 15, 2018 at 22:58
4

Rainbow Parenthesis Highlight matching parens in a rainbow of colors

You must log in to answer this question.