11. 自动代码补全Ctrl+空格。与eclipse中的alt+/ ,VS中的 alt + 向右,相似。若是输入的开头对应的补全结果只有一个则直接自动补全类名、变量名等代码,对应补全的结果有多个,则出现列表选择。注意:Ctrl+空格与系统输入法切换冲突(win8以上搜狗输入法中英文切换,win7如下为windows自身的输入法切换快捷键),因此应把输入代码时的输入法先换为windows自身的英文输入法,或者仍是更改idea的快捷键吧。express
The Code Completion feature lets you quickly complete different kinds of statements in the code. For example, start typing a class name and press Ctrl+空格 to complete it. When multiple choices are available, they are shown in the lookup list.windows
12. get set 等自动生成。按快捷键:alt+insert架构
13.迅速查找某个东西在项目中的全部出处,这个东西能够是一个类、方法或者变量名称等。app
只要你将光标点在上面,而后按Alt+F7。好比点中某个变量,按Alt+F7后,编辑区源代码全部引用该变量的地方高亮显示,idea下方弹出项目下查找结果列表。eclipse
You can quickly find all places where a particular class, method or variable is used in the whole project by positioning the caret at the symbol's name or at its usage in code and pressing Alt+F7 (Edit | Find | Find Usages in the popup menu).ide
14. 快速查看某个类或方法的文档描述,光标点中后请按Ctrl+Qui
To quickly see the documentation for a class or method at caret, press Ctrl+Q (View | Quick Documentation).idea
15. 追溯类、方法、变量的源,进而查看他们的定义和实现代码,你能够按住Ctrl键而后鼠标点击这个类、方法、变量。这个你也许知道,可是若是没鼠标呢?请点击Ctrl+B,效果同样。code
To navigate to the declaration of a class, method or variable used somewhere in the code, position the caret at the usage and press Ctrl+B (Navigate | Declaration). You can also click the mouse on usages with the Ctrl key pressed to jump to declarations.继承
16. 快速查看类内部架构。在VS和eclipse中,都有一个侧边窗口能够完成树状图来展现类的内部结构,idea则能够用快捷键完成。光标处于类中,按Ctrl+F12,就能够看到了。
注意,这里上方还提示了进一步的两个快捷键:
再按一下Ctrl+F12,显示全部继承下成员方法和变量:
再按一下:Ctrl + I,显示匿名类
能够选中其中的一个成员项,点击回车或F4进入定位。
You can quickly navigate in the currently edited file with Ctrl+F12 (Navigate | File Structure).
It shows the list of members of the current class. Select an element you want to navigate to and press the Enter key or the F4 key.
To easily locate an item in the list, just start typing its name.
17. 代码批量更名。若是你想对代码中一个已经存在变量或方法等更名,不须要重复地“查找+替换”。能够光标点中变量,而后按一下 Shift+F6。这时候,diea会推荐几个名称,能够选中其中一个就能够集体更改成推荐名称。
若是想本身更名,能够这样:这时候代码中的全部该变量底色变色,你在其中一处修改变量,其余地方会跟着变化。
如何你再按一次 Shift+F6,会出现一个比较正式的重命名对话框,相似于eclipse。而且,这里能够选择是否替换字符串和注释中的目标名称等。
You can easily rename your classes, methods and variables with automatic correction of all places where they are used.
To try it, place the caret at the symbol you want to rename, and press Shift+F6 (Refactor | Rename). Type the new name in the popup window that appears, or select one of the suggested names, and press Enter.
18. 儿子改老子的方法。若是在编写子类时,若是想覆盖父类中的方法,有快捷键 Ctrl+O,O就是Override。
若是是类想要实现接口中的某个方法,按Ctrl+I,I 就是Implement。
You may easily override methods of the base class by pressing Ctrl+O (Code | Override Methods).
To implement methods of the interfaces that the current class implements (or of the abstract base class), use Ctrl+I (Code | Implement methods).
19. 发现上下文中合适的方法或变量。光标所在位置,按Ctrl+Shift+空格,出现合适的匹配结果。这时候,你可能会问:“我记得Ctrl + 空格 好像也是相似的功能啊?”
举个例子:加入咱们输入了以下,光标位置如图:
Ctrl + 空格 的效果以下:
Ctrl+Shift+空格 直接填充了一个。
因此,咱们对一些类似但不相同的快捷键作个比较:
CTRL+SHIFT+SPACE 自动补全代码
CTRL+空格 代码提示
CTRL+ALT+SPACE 类 名或接口名提示
注意:
CTRL+SHIFT+SPACE 在匹配建议方法或变量的时候才会给出5个合适匹配结果的列表。
The SmartType code completion greatly helps to find methods and variables that are suitable in the current context, by analyzing the expected type of the whole expression. So doing, IntelliJ IDEA pinpoints the top five most suitable results and highlights them on the green background. For example, type
and press Ctrl+Shift+空格:
The SmartType completion also works after the return keyword, in an assignment, in an argument list of a method call and other places.
20. 将选中的代码语句自动构建在一个条件、选择、异常捕获等结构中。只要按Ctrl+Alt+T ,就能够构建多种代码段。
When you want to catch exceptions thrown by some code fragment, select it in the editor, press Ctrl+Alt+T (Code | Surround With) and choose try / catch. The catch blocks for all the exceptions thrown inside the block will be generated automatically.
You can customize the bodies of the generated catch blocks on the Code tab of File | Settings | File and Code Templates.
Use other items in the list to surround with other constructs.