Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 299317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:48:43+00:00 2026-05-12T06:48:43+00:00

I want to customize a syntax coloring in vim for c++. But, unfortunately, i

  • 0

I want to customize a syntax coloring in vim for c++. But, unfortunately, i still can’t find a correct name for braces (){}[] and operators +-/*% for c/c++/objc/objcpp. Any vim guru whi can suggest what name i must ‘hi’ in order to set color for items mentioned?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:48:43+00:00Added an answer on May 12, 2026 at 6:48 am

    I believe that there is no default highlighting for braces as standard in vim for C code or derivative languages (they’re just highlighted as plain text). You could define your own, using something like:

    :syn match Braces display '[{}()\[\]]'
    :hi Braces guifg=red
    

    or you could download the rainbow brace highlighting plugin, which gives varying colours for different levels of indentation. See also my answer to this question.

    :help :syn-match
    :help hi
    

    There is a screenshot of the rainbow brace highlighter in action (with my Bandit colour scheme) here.

    Edit:

    In order to find out the highlighting group of anything that interests you, create this mapping:

    :map <F3> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
    

    (taken from here). Then, move the cursor over whatever you’re interested in and press F3. If it’s not highlighted at all, Vim will print:

    hi<> trans<> lo<>
    

    If there’s a particular highlight group, you’ll get something like this (with the cursor over the if keyword):

    hi<cConditional> trans<cConditional> lo<Conditional>
    

    which tells you that the highlight group is called cConditional and that it is linked (with :hi link) to the group called Conditional. With rainbow brace highlighting, you may get something like cCurly1, which means it’s inside a curly brace, but with no additional highlighting.

    Edit 2:

    A possible operator matcher (not very well tested):

    let cOperatorList  = '[-&|+<>=*/!~]'    " A list of symbols that we don't want to immediately precede the operator
    let cOperatorList .= '\@<!'             " Negative look-behind (check that the preceding symbols aren't there)
    let cOperatorList .= '\%('              " Beginning of a list of possible operators
    let cOperatorList .=     '\('           " First option, the following symbols...
    let cOperatorList .=        '[-&|+<>=]'
    let cOperatorList .=     '\)'
    let cOperatorList .=     '\1\?'         " Followed by (optionally) the exact same symbol, so -, --, =, ==, &, && etc
    let cOperatorList .= '\|'               " Next option:
    let cOperatorList .=     '->'           " Pointer dereference operator
    let cOperatorList .= '\|'               " Next option:
    let cOperatorList .=     '[-+*/%&^|!]=' " One of the listed symbols followed by an =, e.g. +=, -=, &= etc
    let cOperatorList .= '\|'               " Next option:
    let cOperatorList .=     '[*?,!~%]'     " Some simple single character operators
    let cOperatorList .= '\|'               " Next option:
    let cOperatorList .=     '\('           " One of the shift characters:
    let cOperatorList .=         '[<>]'     
    let cOperatorList .=     '\)'
    let cOperatorList .=     '\2'           " Followed by another identical character, so << or >>...
    let cOperatorList .=     '='            " Followed by =, so <<= or >>=.
    let cOperatorList .= '\)'               " End of the long list of options
    let cOperatorList .= '[-&|+<>=*/!~]'    " The list of symbols that we don't want to follow
    let cOperatorList .= '\@!'              " Negative look-ahead (this and the \@<! prevent === etc from matching)
    
    exe "syn match cOperator display '" . cOperatorList . "'"
    
    syn match cOperator display ';'
    hi link cOperator Operator
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to customize my archives to sort by month, but if it was
We want to customize the My Site templates for different roles, say Students and
I want allow the user to customize their web pages on my ASP.NET MVC
I want to reference a COM DLL in a .NET project, but I also
I want to customize the reflection from the FlowCover (Cover Flow remake) sample code.
I want to customize the looks of the range input type in HTML5 to
I want to customize the folders that are used to save my images for
There are customers that want to customize to brand my product, while have me
I use WordPress for several websites. I want to customize one of the RSS
I integrated google maps in my rails project using ym4r_gm. I want to customize

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.