Eclipse jump to closing brace

EclipseKeyboard ShortcutsCurly Braces

Eclipse Problem Overview


What is the keyboard short cut in Eclipse to jump to the closing brace of a scope?

Eclipse Solutions


Solution 1 - Eclipse

Place the cursor next to an opening or closing brace and punch Ctrl + Shift + P to find the matching brace. If Eclipse can't find one you'll get a "No matching bracket found" message.

edit: as mentioned by Romaintaz below, you can also get Eclipse to auto-select all of the code between two curly braces simply by double-clicking to the immediate right of a opening brace.

Solution 2 - Eclipse

As the shortcut Ctrl + Shift + P has been cited, I just wanted to add a really interesting feature: just double-click to the immediate right of the {, and Eclipse will select the whole code block between the opening { and corresponding closing }. Similarly, double-click to the immediate left of the closing '}' and eclipse will select the block.

Solution 3 - Eclipse

With Ctrl + Shift + L you can open the "key assist", where you can find all the shortcuts.

Solution 4 - Eclipse

On the Macintosh, place the cursor after either the opening or closing curly brace } and use the keys: Shift + Command + P.

Solution 5 - Eclipse

To select content use Alt + Shift + Up arrow

To select content up to the next wrapping block press this shortcut again

To go back one step press Alt + Shift + Down arrow. This is also a useful shortcut when you need to select content in a complex expression and do not want to miss something.

Solution 6 - Eclipse

Press Ctrl + Shift + P.

Before Eclipse Juno you need to place the cursor just beyond an opening or closing brace.

In Juno cursor can be anywhere in the code block.

Solution 7 - Eclipse

I found that if the chosen perspective doesn't match the type of the current file, then "go to matching brace" doesn't work. However, changing perspectives makes it work again. So, for example, when I have a PHP file open, but, say, the Java perspective active, pressing Ctrl + Shift + P does nothing. For the same file with the PHP perspective active, pressing Ctrl + Shift + P does exactly what you'd expect and puts my cursor beside the closing brace relative to the one it started at.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTrastleView Question on Stackoverflow
Solution 1 - EclipseninesidedView Answer on Stackoverflow
Solution 2 - EclipseRomain LinsolasView Answer on Stackoverflow
Solution 3 - EclipseTobias SchulteView Answer on Stackoverflow
Solution 4 - EclipseDale McGrewView Answer on Stackoverflow
Solution 5 - EclipseChristophe RoussyView Answer on Stackoverflow
Solution 6 - EclipsemmmView Answer on Stackoverflow
Solution 7 - EclipseVanhoyView Answer on Stackoverflow