注意:这篇文章是基于 Intellij IDEA 版本,2016.3 Ultimate 来写的,快捷键是 Mac OS 10.5+。
关闭 Intellij IDEA 的 Tab 页
为什么要关闭 Intellij IDEA 的 Tab 页呢,Tab 页放在那里,当我们每次需要找文件的时候,都先要去 Tab 页瞄一眼,看下在不在 Tab 页,如果在的话,用鼠标点一下。这种操作的效率其实非常慢,更加快速的方式是直接关闭掉 Tab 页的功能:

然后直接用Command + E来找到最近访问的文件:

或者直接用Command + Shift + E来访问最近编辑的文件:

跳到特定文件夹
Intellij IDEA 和 Eclipse 都有快速根据类名寻找类,或者根据资源名寻找资源的方式,但是如果我们想找一个文件夹,在 Intellij IDEA 里面,可以输入/文件夹名来跳到特定的文件夹(使用 Double Shift 快捷键),截图如下:

快速补全行末分号
Java 中,每一个 statement 后面都得加上;号,我们可以在行中任意位置使用快捷键Command + Shift + Enter来快速补全分号:

Rest Client
Intellij IDEA 里面内置了一个 Rest Client,大家可以通过Command + Shift + A,然后搜索Rest Client来找到:

打开以后,可以看到一个简单的 Rest Client:

之所以说它比较简单是因为个人觉得还是 Postman 更加强大,Postman 的管理功能更加强大,而 Intellij IDEA Rest Client 则缺少这样的能力。
Hippie Completion
这种自动补全的模式,会选择当前编辑器中适合的单词直接拿过来补全:

粘贴版历史
如果使用过 Mac 里面的Alfred的话,可能大家早就习惯了 Alfred 的粘贴板历史的能力,真是复制粘贴的神器啊。其实 Intellij IDEA 里面也提供了这样的能力,我们可以直接通过Command + Shift + V来进行访问历史粘贴板:

Language Injection
大家都知道在 Java 的 String 中编辑有 JSON 的话有多麻烦,各种转义真是让人疯狂,在 Intellij IDEA 中,我们可以直接使用 Intellij IDEA 的 Language Injection 的功能(Alt + Enter)将一个字符串标记为 JSON,就可以非常方便地编写 JSON 了,再也不用担心转义的问题了:

当然,正则表达式也是支持的,甚至支持简单的正则表达式的测试能力:

Smart Step Into
在 Debug 的时候,如果一行代码中有多行语句,我们又需要进入其中的一个方法调用的话,经常做的方法是点开源代码,然后打上断点,或者直接右键Run to Line,而不能使用快捷键快速将 Debug 的当前行进入到想要去的方法上,Intellij IDEA 提供了 Smart Step Into 的能力,只要使用Shift + F7,就可以选择到底要 Debug 进入哪一个方法:

网友评论