如何将多个动作绑定到快捷方式 [英] How to bind multiple actions to a shortcut

查看:89
本文介绍了如何将多个动作绑定到快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Each time I finished editing a Java class, I want to : Organize imports, Reformat code and Rearrange code. I have to hit 3 keyboard shortcuts.

是否可以将一系列操作分配给单个快捷方式?

Is there a way to assign a chain of actions to a single shortcut ?

我正在使用IntelliJ 14.1.5.

I am using IntelliJ 14.1.5.

推荐答案

您可以记录包含要执行的动作的宏,并为该宏分配快捷方式.

You can record a macro consisting of the actions you want to perform and assign a shortcut to that macro.

此处中描述了该过程.为了完整起见,以下是这些在线指南中的步骤(贷记给Jetbrains):

The process is described here. For the sake of completeness, here are the steps from these online guides (credit goes to Jetbrains):

要录制宏

  • 在主菜单上,选择编辑" |选择".宏|开始宏录制.从那一刻起,您所有可记录的动作都会被记录.
  • 完成该过程后,选择编辑" |其他".宏|停止宏录制.
  • 在输入宏名称"对话框中,指定新宏的名称,然后单击确定".如果该宏仅用于临时使用,则可以 将名称留空.
  • 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.

使用键盘快捷键绑定宏

  • 打开设置"对话框,然后单击键盘映射".
  • 创建新的键盘映射运行/调试配置:PHP脚本,或从键盘映射列表中选择可编辑的键盘映射.
  • 展开宏"节点,然后选择应为其创建键盘快捷键的宏.
  • 右键单击宏,然后在上下文菜单中选择添加键盘快捷键".
  • 在输入键盘快捷键"对话框中,按要用作快捷键的键.按键立即反映在第一 中风场. (可选)选中第二笔划复选框,然后 指定第二笔画.按下按键时,预览字段 显示您按下的击键,并且显示冲突"字段 警告,如果已在使用击键.
  • 使用鼠标指针单击确定"以创建快捷方式并将其与宏绑定.
  • 单击应用"以保存设置.
  • 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.

这篇关于如何将多个动作绑定到快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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