如何使用键盘快捷键在 Intellij-IDEA 中显示(展开)隐藏(折叠)的代码? [英] How to show(unfold) the hidden(folded) code in Intellij-IDEA with keyboard shortcut?

查看:118
本文介绍了如何使用键盘快捷键在 Intellij-IDEA 中显示(展开)隐藏(折叠)的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 IntelliJ IDEA 中显示(展开)隐藏(折叠)的代码,如下图所示,只使用键盘而不触摸鼠标?

How can I show(unfold) the hidden(folded) code in IntelliJ IDEA, as shown in the picture below, just using keyboard without touching the mouse?

推荐答案

在 IntelliJ IDEA 中,您可以使用以下快捷方式折叠/展开代码块:

In IntelliJ IDEA you can use to following shortcuts to fold/unfold code blocks:

  • 折叠展开 当前选定的代码块:
    • CTRL+-CTRL++ 在 Windows 上;
    • ⌘ CMD+-⌘ CMD++ 在 Mac 上;
    • To fold and unfold CURRENT selected block of code:
      • CTRL+- and CTRL++ on Windows;
      • ⌘ CMD+- and ⌘ CMD++ on Mac;
      • CTRL+⇧ SHIFT+-CTRL+⇧ SHIFT++ 在 Windows 上
      • ⌘ CMD+⇧ SHIFT+-⌘ CMD+⇧ SHIFT++ 在 Mac 上.
      • CTRL+⇧ SHIFT+- and CTRL+⇧ SHIFT++ on Windows
      • ⌘ CMD+⇧ SHIFT+- and ⌘ CMD+⇧ SHIFT++ on Mac.

      顺便说一下,在设置→编辑器→常规→代码折叠中,您可以为各种情况指定默认折叠行为(例如,importsone-line 方法内部类@SuppressWarnings注解数组字面量泛型构造函数等等其他):

      By the way, in Settings → Editor → General → Code Folding you can specify the default folding behavior for a various situations (e.g., imports, one-line methods, inner classes, @SuppressWarnings annotations, array literals, generic constructors and many others):

      即使在那之后,您上面列出的折叠/展开热键也能正常工作.

      And even after that your folding/unfolding hotkeys listed above will work as well.

      这篇关于如何使用键盘快捷键在 Intellij-IDEA 中显示(展开)隐藏(折叠)的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆