intellij-idea - 如何将多个操作绑定(bind)到快捷方式

标签 intellij-idea intellij-14

每次我完成一个 Java 类的编辑后,我都想:组织导入、重新格式化代码和重新排列代码。我必须按 3 个键盘快捷键。

有没有办法将一系列 Action 分配给单个快捷方式?

我正在使用 IntelliJ 14.1.5。

最佳答案

您可以录制包含要执行的操作的宏,并为该宏分配快捷方式。

该过程描述here .为了完整起见,以下是这些在线指南中的步骤(归功于 Jetbrains):

To record a macro

  • On the main menu, choose Edit | Macros | Start Macro Recording. From that moment on, all your recordable actions are recorded.
  • When you are done with the procedure, choose Edit | Macros | Stop Macro Recording.
  • In the Enter Macro Name dialog, specify the name of the new macro, and click OK. If the macro is intended for temporary use only, you can leave the name blank.

To bind a macro with a keyboard shortcut

  • Open the Settings dialog and click Keymap.
  • Create a new keymap Run/Debug Configuration: PHP Script or select an editable keymap from the list of keymaps.
  • Expand the Macros node and select the macro for which a keyboard shortcut should be created.
  • Right-click on the macro and choose Add Keyboard Shortcut in the context menu.
  • In the Enter Keyboard Shortcut dialog, press the keys to be used as a shortcut. The keystrokes are immediately reflected in the First Stroke field. Optionally, select the Second stroke check box and specify the second stroke. As you press the keys, the Preview field displays the keystrokes you pressed, and the Conflicts field displays warnings, if the keystrokes are already in use.
  • Click OK using the mouse pointer to create a shortcut and bind it with the macro.
  • Click Apply to save the settings.

关于intellij-idea - 如何将多个操作绑定(bind)到快捷方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32948061/

相关文章:

java - 如何设置 IntelliJ IDEA 默认文档字体大小?

python - PyCharm/IntelliJ 启用包依赖项检查

intellij-idea - intellij idea中的 "working set"等价物是什么?

intellij-idea - 如何激活显示方法值的参数名称的新折叠

java - Spring:无法 Autowiring 字段 - 找不到类型的 bean

git - 设置 IntelliJ IDEA 和 Git

java - 制作自定义 Gradle 任务,生成代码,在 IDE 导入上运行

intellij-idea - 如何在不编辑 bin 中的文件的情况下配置 IntelliJ 产品?

mysql - 数据库未连接。它可以和什么联系起来?

java - 如何将一个项目作为 Maven 依赖项添加到另一个项目