Eclipse 跳转到右括号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/289342/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:30:52  来源:igfitidea点击:

Eclipse jump to closing brace

eclipsekeyboard-shortcutscurly-braces

提问by Trastle

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

Eclipse 中跳转到示波器右括号的键盘快捷键是什么?

回答by ninesided

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

将光标放在左大括号或右大括号旁边,然后敲击Ctrl+ Shift+P以找到匹配的大括号。如果 Eclipse 找不到,您将收到“找不到匹配的括号”消息。

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.

编辑:正如下面 Romaintaz提到的,您还可以让 Eclipse 自动选择两个大括号之间的所有代码,只需双击左大括号的右侧即可。

回答by Romain Linsolas

As the shortcut Ctrl+ Shift+ Phas 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.

作为快捷Ctrl+ Shift+P已经被引用,我只是想补充一个非常有趣的功能:只需双击来的眼前右{,和Eclipse将选择开放的整个代码块{和相应的结束}。类似地,双击关闭的 '}' 的左侧,eclipse 将选择该块。

回答by Tobias Schulte

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

随着Ctrl+ Shift+ L,你可以打开“键协助”,在这里你可以找到所有的快捷方式。

回答by Tobias Schulte

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

在 Macintosh 上,将光标放在左花括号或右花括号之后,}并使用键:Shift+ Command+ P

回答by Christophe Roussy

To select content use Alt+ Shift+ Up arrow

选择内容使用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.

要后退一步,请按Alt+ Shift+ Down arrow。当您需要选择复杂表达式中的内容并且不想遗漏某些内容时,这也是一个有用的快捷方式。

回答by mmm

Press Ctrl+ Shift+ P.

Ctrl+ Shift+ P

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

在 Eclipse Juno 之前,您需要将光标置于左括号或右括号之外。

In Juno cursor can be anywhere in the code block.

在 Juno 中,游标可以位于代码块中的任何位置。

回答by Vanhoy

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+ Pdoes nothing. For the same file with the PHP perspective active, pressing Ctrl+ Shift+ Pdoes exactly what you'd expect and puts my cursor beside the closing brace relative to the one it started at.

我发现如果选择的透视图与当前文件的类型不匹配,那么“转到匹配大括号”将不起作用。然而,改变观点使它再次起作用。因此,举例来说,当我有一个PHP文件打开,但是,说,Java透视图活跃,按Ctrl+ Shift+P什么也不做。对于 PHP 透视图处于活动状态的同一个文件,按Ctrl+ Shift+P完全符合您的预期,并将我的光标放在相对于它开始处的右大括号旁边。