Finding the matching curley bracket { }

I have been away from programming for some time, but I recall there was a way,
at least in the Borland compiler IDE to locate the matching curly bracket by
placing the cursor on one then some other key or combination to go to the other.
Could be I am thinking abut Pascal.
If you use proper indentation finding the matching bracket should always be easy.
It's been quite a while since I've last used an editor that didn't automatically highlight matching bracket pairs when putting the cursor on them.
All modern IDE editors highlight the matching brace in some way, but there are shortcuts for jumping as well (Ctrl+Shift+B in Code::Blocks, Ctrl+Shift+P in Eclipse).
The Code::Blocks IDE will highlight sets of curly brackets and parenthesis. All you need to do is position your cursor next to one of the curly brackets or parenthesis in the code editor. It also has another feature where it automatically adds the closing parenthesis or curly bracket. Both of these features are on by default.

Here is the official Code::Blocks website: http://www.codeblocks.org/

If you want to turn off the feature that automatically adds a closing brace, here are the instructions.

1) In the top menu, click 'settings', and then click 'editor...' in the drop down menu.
2) Look for 'Brace Completion' in the 'General Settings' tab. Uncheck it.

(As Athar said, to move to the other curly bracket, use Ctrl+Shift+B. It will move your cursor to the matching bracket in Code::Blocks.)
Last edited on
It also has another feature (which I find annoying, but you may like it) where it automatically adds the closing parenthesis or curly bracket.

Well, you can disable it if you want.
A better idea is to update to the latest C::B svn, which has almost perfect brace completion.
Thanks to all for your replies. I tried the 2 ctrl-shift methods mentioned by athar. Neither
works. Maybe I was thinking of some other compiler I was using back in the day.

ls909 wrote:
Here is the official Code::Blocks website: http://www.codeblocks.org/


Thanks for the link. I have bookmarked it in case I decide to do some new programming.

I noticed in my source code, I would put a comment next to the end brace.

} // if a>b

Maybe I was thinking of some other compiler I was using back in the day.


Bracket matching is no feature of a compiler, it's an editor feature.
Visual Studio 2010 shows which bracket matches the one you've selected
I found the answer I was looking for.

While the cursor in positioned on the opening brace {
Use <CTRL> Q ] to move cursor to the end brace. Yes, ] finds }

Use <CTRL> Q [ to move cursor to the start brace.

I find these useful when the matching brace is not visible on the screen.
Topic archived. No new replies allowed.