views:

719

answers:

3

How do I highlight operators/parentheses/brackets/etc. in VIM? I'm not interested in coloring matching or unmatching parentheses/brackets.

I've tried ":hi cBracket/whatnot guifg=something" and ":hi Operator/cOperator guifg=something" but these don't seem to affect anything.

+4  A: 

There are two parts to Vim syntax coloring: the syn command and the hi command.

As far as I understand, you use syn to define syntax. For example:

syn match parens /[(){}]/

Then you use hi to tell Vim how to highlight parens:

hi parens ctermfg=red
David Wolever
A: 

The solution above breaks code folding that's syntax based (because of the rules with {} overriding something previous). I haven't been able to figure out how to get around this...

A: 

See :h pi_paren.txt about highlighting matching parens:

To disable the plugin after it was loaded use this command: >
    :NoMatchParen
And to enable it again: >
    :DoMatchParen
The highlighting used is MatchParen.  You can specify different colors with
the ":highlight" command.  Example: >
    :hi MatchParen ctermbg=blue guibg=lightblue

 ...
fgm