简体   繁体   English

在IntelliJ IDEA中选择键盘快捷键的原理是什么?

[英]What is the principle by which keyboard shortcuts selected in IntelliJ IDEA?

There are lots of useful functions of Intellij IDEA and for many of them there are keyboard shortcuts. Intellij IDEA有很多有用的功能,并且其中许多都有键盘快捷键。

But remembering shortcuts may be difficult, at least for me. 但是记住捷径可能很困难,至少对我而言。

Are there some consistent guiding principles by which these shortcuts were selected by designers? 设计师是否有一些一致的指导原则来选择这些快捷方式? I believe learning such principles would be helpful to memorize shortcuts itself. 我相信学习这样的原理将有助于记住快捷方式本身。

I think that the closest answer you're going to get is "it depends". 我认为您将获得的最接近答案是“取决于”。 Some shortcuts are obviously chosen, because the keybinding describes what the shortcut does, for example + O means open, not only in IntelliJ but in many places throughout OS X. 显然选择了一些快捷方式,因为键绑定描述了快捷方式的作用,例如 + O意味着打开,不仅在IntelliJ中而且在OS X的许多地方。

Some shortcuts probably don't have any kind of such semantic meaning, such as Alt + Enter and are chosen because they are very frequently used and the placement of the keys relative to each other is comfortable. 一些快捷方式可能没有任何这样的语义含义,例如Alt + Enter并被选择,是因为它们非常常用,并且键相对于彼此的放置很舒适。

Other keyboard shortcuts with similar purpose have the same starting sequence of keys. 具有类似目的的其他键盘快捷键具有相同的按键开始顺序。 For instance the extract refactoring shortcuts, which are as follows: 例如,提取重构快捷方式如下:

  • + Alt + M - extract method + Alt + M-提取方法
  • + Alt + C - extract constant + Alt + C-提取常数
  • + Alt + V - extract variable + Alt + V-提取变量
  • + Alt + F - extract field + Alt + F-提取字段
  • + Alt + P - extract parameter + Alt + P-提取参数

So in such case you only need to remember that if you want to extract something, you press + Alt and the first letter of what you want to extract. 因此,在这种情况下,您只需要记住,如果要提取某些内容,请按 + Alt和要提取的内容的第一个字母。


That being said, I don't believe that the way to learning the keybindings is memorizing them, but using them. 话虽如此,我不认为学习按键绑定的方法是记住它们,而是使用它们。 If you use one keybinding multiple times, over the time you will memorize it. 如果您多次使用一个键盘绑定,那么随着时间的流逝,您会记住它。 You can help this process for instance by locating the action you want to perform in the menu, but instead of clicking it look at the keyboard shortcut next to it and press it. 例如,您可以通过在菜单中找到要执行的操作来帮助完成此过程,但与其单击它,不如单击它旁边的键盘快捷键并按它。 Or find the action using + Shift + A , look at the shortcut and use it. 或者使用 + Shift + A查找动作,查看快捷方式并使用它。

There are even plugins, which can help you with this, for instance Key Promoter which you can install via Settings/Plugins/Browse Repositories . 甚至还有可以帮助您解决此问题的插件,例如可以通过Settings / Plugins / Browse Repositories安装的Key Promoter。 This plugin shows you shortcut you can use when you invoke some actions by clicking it in menu, etc. It also shows you how many times you've used this action in such a way instead of using the corresponding shortcut. 该插件显示了您在菜单中单击等调用某些操作时可以使用的快捷方式。它还显示了以这种方式(而不是使用相应的快捷方式)使用此操作的次数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM