Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set curly braces'/parentheses'/square brackets'/arithmetic operators' syntax highlight color in VIM?

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.

like image 521
user87362 Avatar asked Apr 05 '09 18:04

user87362


2 Answers

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
like image 67
David Wolever Avatar answered Sep 29 '22 06:09

David Wolever


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

 ...
like image 42
Fritz G. Mehner Avatar answered Sep 29 '22 07:09

Fritz G. Mehner