Eclipse 中是否有用于折叠当前方法/块的键盘快捷键?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/512976/
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:36:58  来源:igfitidea点击:

Is there a keyboard shortcut in Eclipse to fold the current method/block?

eclipseidekeyboard-shortcuts

提问by dw.mackie

Hey, question says it all. I have folding turned on in Eclipse (v3.4), and rather than having to click the little +/- in the page gutter, I'm wondering if there's a keyboard shortcut to just "fold the current method". A quick look at the menus and what-not in eclipse doesn't show a menu item for it, so maybe you just can't do it.

嘿,问题说明了一切。我在 Eclipse (v3.4) 中打开了折叠,而不必单击页面装订线中的小 +/-,我想知道是否有一个键盘快捷键可以“折叠当前方法”。快速浏览一下 eclipse 中的菜单和 what-not 并没有显示它的菜单项,所以也许你做不到。

Anyone?

任何人?

回答by JMD

To expand on petrilli's answer:

扩展 petrilli 的回答:

  • Ctrl+ Numpad_Multiplycan also be used to expand all
  • Ctrl+ Shift+ Numpad_Divideis bound to collapse all
  • Ctrl+ Numpad_Dividetoggles folding on and off
  • Ctrl+Numpad_Multiply也可用于展开所有
  • Ctrl+ Shift+Numpad_Divide是必然崩溃所有
  • Ctrl+Numpad_Divide打开和关闭折叠

And yes, they can all be rebound, if you know what text to filter on in Windows | Preferences | General | Keys.

是的,如果您知道在 Windows 中要过滤的文本,它们都可以被反弹。偏好 | 一般 | 钥匙。

"Folding", "Expand", "Collapse" are keywords that should get you all of the relevant commands.

“折叠”、“展开”、“折叠”是应该为您提供所有相关命令的关键字。

回答by JMD

By default they're bound to Ctrl+ Numpad_Minusand Ctrl+ Numpad_Plus, but you can rebind them.

默认情况下,它们绑定到Ctrl+Numpad_MinusCtrl+ Numpad_Plus,但您可以重新绑定它们。

回答by Crazyshezy

If you are using eclipse-pydev then the default keybinds are

如果您使用的是 eclipse-pydev,那么默认的键绑定是

ctrl+ 9: collapse all one level

ctrl+ 9: 折叠所有一层

ctrl+ 0: expand all one level

ctrl+ 0: 展开所有一层

ctrl+ -_: collapse current location

ctrl+ -_: 折叠当前位置

ctrl+ =+: expand current

ctrl+ =+: 展开电流