views:

2597

answers:

6

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

+11  A: 

Place the cursor just beyond the opening brace and punch CTRL+SHIFT+P to find the matching closing brace. If Eclipse can't find one you'll get a "No matching bracket found" message.

ninesided
+6  A: 

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

Tobias Schulte
+1  A: 

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

+1  A: 

I have read tons of forums that talk about the ability of Eclipse to go to the matching brace, generally with Shift + Control/Command + P. However, this apparently does not work if you are using a different language other than Java. Anyone know something I don't? Apparently I am not the only one: http://dev.eclipse.org/newslists/news.eclipse.tools.cdt/msg03352.html

A: 

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.

Vanhoy
+3  A: 

As the shortcut Ctrl+Shift+P has been cited, I just wanted to add a really interesting feature: just double-click on the line, after the {, and Eclipse will select the whole code block between the opening { and corresponding closing }.

romaintaz